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 From c4b2d24f337eeaf8c7d8e643c3491d491d584cde Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:17:07 +0000 Subject: Add llGiveInventory() test from object to object where both objects are owned by the same user. --- OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | 11 ++++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 15060fd..1334905 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -155,6 +155,15 @@ namespace OpenSim.Region.Framework.Interfaces TaskInventoryItem GetInventoryItem(UUID itemId); /// + /// Get all inventory items. + /// + /// + /// + /// If there are no inventory items then an empty list is returned. + /// + List GetInventoryItems(); + + /// /// Get inventory items by name. /// /// @@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces /// A list of inventory items with that name. /// If no inventory item has that name then an empty list is returned. /// - IList GetInventoryItems(string name); + List GetInventoryItems(string name); /// /// Get the scene object referenced by an inventory item. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f2d1915..71a9084 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes /// A list of inventory items with that name. /// If no inventory item has that name then an empty list is returned. /// - public IList GetInventoryItems(string name) + public List GetInventoryItems(string name) { - IList items = new List(); + List items = new List(); lock (m_items) { @@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes public List GetInventoryItems() { - List ret = new List(); + List ret = new List(); lock (m_items) ret = new List(m_items.Values); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index e16903c..55c80f5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests } /// - /// Test MoveTaskInventoryItem where the item has no parent folder assigned. + /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned. /// /// /// This should place it in the most suitable user folder. @@ -142,9 +142,11 @@ namespace OpenSim.Region.Framework.Tests } /// - /// Test MoveTaskInventoryItem where the item has no parent folder assigned. + /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned. /// + /// /// This should place it in the most suitable user folder. + /// [Test] public void TestMoveTaskInventoryItemNoParent() { -- cgit v1.1 From 760010d6fb6aac313d79ce0a4d0016d3809246a0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:33:37 +0000 Subject: Fix llGiveInventory() so that it checks the destination part for AllowInventoryDrop, not the source. This allows llAllowInventoryDrop() to work. Regression test added for this case. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6ae4adc..d10136f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Copy a task (prim) inventory item to another task (prim) /// - /// - /// - /// + /// ID of destination part + /// Source part + /// Source item id to transfer public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) { TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); @@ -1240,10 +1240,10 @@ namespace OpenSim.Region.Framework.Scenes // Can't transfer this // - if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) + if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) return; - if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) { // object cannot copy items to an object owned by a different owner // unless llAllowInventoryDrop has been called -- cgit v1.1 From 5bf45b9b98571f92715ea988ec276b36fa8d193c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:40:38 +0000 Subject: refactor: simplify code for checks when part.OwnerID != destPart.OwnerID in MoveTaskInventoryItem() --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index d10136f..5abd74f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes return; } - // Can't transfer this - // - if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - return; - - if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + if (part.OwnerID != destPart.OwnerID) { - // object cannot copy items to an object owned by a different owner - // unless llAllowInventoryDrop has been called + // Source must have transfer permissions + if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + return; - return; + // Object cannot copy items to an object owned by a different owner + // unless llAllowInventoryDrop has been called on the destination + if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + return; } // must have both move and modify permission to put an item in an object if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) - { return; - } TaskInventoryItem destTaskItem = new TaskInventoryItem(); -- cgit v1.1 From 40b9b519b89f5da08e1e6b6557934bfd39b4f90b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 00:12:14 +0000 Subject: Add commented out section on collisions switch in Scene.SetSceneCoreDebug(). This was not implemented before the recent changes but should be at some point. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e632e..9d882c0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1074,6 +1074,12 @@ namespace OpenSim.Region.Framework.Scenes m_physics_enabled = enablePhysics; } +// if (options.ContainsKey("collisions")) +// { +// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow +// // the avatar themselves to collide with the ground. +// } + if (options.ContainsKey("teleport")) { bool enableTeleportDebugging; -- cgit v1.1 From 08b8ebcc7e71038894fa47757db6d6aa5bb66d00 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 00:54:37 +0000 Subject: Use m_lastFrameTick instead of m_lastUpdate in Scene.GetHealth(). m_lastUpdate is no longer properly updated and is redundant anyway. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 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 9d882c0..16ce1ba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4504,8 +4504,8 @@ namespace OpenSim.Region.Framework.Scenes // int health=1; // Start at 1, means we're up - if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) - health+=1; + if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) + health += 1; else return health; -- cgit v1.1 From bc2963d42ab998551603b74361b26d5dfd5d0acd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:03:10 +0000 Subject: Comment out unused scene loop restart code. This has actually been unused since at least 0.7.2 due to earlier changes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 41 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 16ce1ba..d89d94d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -216,9 +216,7 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; private volatile int m_bordersLocked; -// private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing -// private int m_incrementsof15seconds; private volatile bool m_backingup; private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); @@ -226,12 +224,17 @@ namespace OpenSim.Region.Framework.Scenes private bool m_physics_enabled = true; private bool m_scripts_enabled = true; private string m_defaultScriptEngine; + + /// + /// Tick at which the last login occurred. + /// private int m_LastLogin; + private Thread HeartbeatThread; private volatile bool shuttingdown; - private int m_lastUpdate; - private bool m_firstHeartbeat = true; +// private int m_lastUpdate; +// private bool m_firstHeartbeat = true; private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private bool m_reprioritizationEnabled = true; @@ -801,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes m_permissions = new ScenePermissions(this); - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); } #endregion @@ -1170,7 +1173,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread.Abort(); HeartbeatThread = null; } - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); HeartbeatThread = Watchdog.StartThread( @@ -1222,8 +1225,8 @@ namespace OpenSim.Region.Framework.Scenes while (!shuttingdown) Update(-1); - m_lastUpdate = Util.EnvironmentTickCount(); - m_firstHeartbeat = false; +// m_lastUpdate = Util.EnvironmentTickCount(); +// m_firstHeartbeat = false; } finally { @@ -2541,7 +2544,7 @@ namespace OpenSim.Region.Framework.Scenes = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - CheckHeartbeat(); +// CheckHeartbeat(); ScenePresence sp = GetScenePresence(client.AgentId); @@ -3117,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes public override void RemoveClient(UUID agentID, bool closeChildAgents) { - CheckHeartbeat(); +// CheckHeartbeat(); bool isChildAgent = false; ScenePresence avatar = GetScenePresence(agentID); if (avatar != null) @@ -4516,7 +4519,7 @@ namespace OpenSim.Region.Framework.Scenes else return health; - CheckHeartbeat(); +// CheckHeartbeat(); return health; } @@ -4704,14 +4707,14 @@ namespace OpenSim.Region.Framework.Scenes return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; } - private void CheckHeartbeat() - { - if (m_firstHeartbeat) - return; - - if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) - StartTimer(); - } +// private void CheckHeartbeat() +// { +// if (m_firstHeartbeat) +// return; +// +// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) +// StartTimer(); +// } public override ISceneObject DeserializeObject(string representation) { -- cgit v1.1 From a9995ede65d1327413ae5c5e9b2e6f6dcf0f11c2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:08:13 +0000 Subject: Fix bug in ScenePresenceAnimator.RemoveAnimation() introduced in commit 1a8769e Forgot to uppercase the animation name for default animations, since for some reason we store and use them in upper rather than lowercase. --- OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index cded9be..f5623bd 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -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 = DefaultAvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d89d94d..6fea5ff 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the timer which triggers regular scene updates + /// Start the scene loop /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); -- cgit v1.1 From 4ee8b3e23edc9ca11cf3d17f24fddfdcbfd8c1cc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:11:43 +0000 Subject: Fix build break --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6fea5ff..8a4c6c9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1161,7 +1161,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Start the scene loop /// - public void Start() + public void StartTimer() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); -- cgit v1.1 From 18b3f1132eeb28e51d84e028e4fd69048150ccb7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:21:43 +0000 Subject: Rename Scene.StartTimer() to Start() - this method no longer uses a timer. Comment out more effectively unused old heartbeat code. --- OpenSim/Region/Framework/Scenes/Scene.cs | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8a4c6c9..d354ef0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -211,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes /// private bool m_cleaningTemps = false; - private Object m_heartbeatLock = new Object(); +// private Object m_heartbeatLock = new Object(); // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the scene loop + /// Start the scene /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); @@ -1206,33 +1206,34 @@ namespace OpenSim.Region.Framework.Scenes /// private void Heartbeat() { - if (!Monitor.TryEnter(m_heartbeatLock)) - { - Watchdog.RemoveThread(); - return; - } +// if (!Monitor.TryEnter(m_heartbeatLock)) +// { +// Watchdog.RemoveThread(); +// return; +// } - try - { - m_eventManager.TriggerOnRegionStarted(this); +// try +// { + + m_eventManager.TriggerOnRegionStarted(this); - // The first frame can take a very long time due to physics actors being added on startup. Therefore, - // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false - // alarms for scenes with many objects. - Update(1); - Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + // The first frame can take a very long time due to physics actors being added on startup. Therefore, + // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false + // alarms for scenes with many objects. + Update(1); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; - while (!shuttingdown) - Update(-1); + while (!shuttingdown) + Update(-1); // m_lastUpdate = Util.EnvironmentTickCount(); // m_firstHeartbeat = false; - } - finally - { - Monitor.Pulse(m_heartbeatLock); - Monitor.Exit(m_heartbeatLock); - } +// } +// finally +// { +// Monitor.Pulse(m_heartbeatLock); +// Monitor.Exit(m_heartbeatLock); +// } Watchdog.RemoveThread(); } -- cgit v1.1