From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- .../Framework/Interfaces/IAttachmentsModule.cs | 9 - .../Framework/Interfaces/IDynamicTextureManager.cs | 69 +-- .../Framework/Interfaces/IEntityInventory.cs | 27 +- .../Region/Framework/Interfaces/IEstateModule.cs | 4 - .../Framework/Interfaces/IJsonStoreModule.cs | 2 +- .../Framework/Interfaces/IScriptModuleComms.cs | 71 +-- .../Region/Framework/Interfaces/ISoundModule.cs | 93 +-- OpenSim/Region/Framework/Interfaces/IUrlModule.cs | 2 - .../Region/Framework/Interfaces/IUserManagement.cs | 29 +- OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 26 +- .../Framework/Scenes/Animation/AnimationSet.cs | 13 - OpenSim/Region/Framework/Scenes/EventManager.cs | 521 +--------------- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 24 +- OpenSim/Region/Framework/Scenes/Scene.cs | 685 ++++++++------------- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 35 +- OpenSim/Region/Framework/Scenes/SceneManager.cs | 6 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 106 +--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 300 +++++---- .../Framework/Scenes/SceneObjectPartInventory.cs | 58 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 56 +- .../Region/Framework/Scenes/SimStatsReporter.cs | 35 -- .../Scenes/Tests/ScenePresenceAgentTests.cs | 2 +- .../Region/Framework/Scenes/Tests/SceneTests.cs | 17 - .../Framework/Scenes/Tests/UserInventoryTests.cs | 36 +- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 138 ++--- 26 files changed, 566 insertions(+), 1805 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index d781eae..90a13a7 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -114,15 +114,6 @@ namespace OpenSim.Region.Framework.Interfaces void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID); /// - /// Detach the given item to the ground at the specified coordinates & rotation - /// - /// - /// - /// - /// - void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID, Vector3 absolutePos, Quaternion absoluteRot); - - /// /// Detach the given attachment so that it remains in the user's inventory. /// /// /param> diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs index 6df5cc2..8954513 100644 --- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs @@ -25,8 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Drawing; using System.IO; using OpenMetaverse; @@ -35,14 +33,7 @@ namespace OpenSim.Region.Framework.Interfaces public interface IDynamicTextureManager { void RegisterRender(string handleType, IDynamicTextureRender render); - - /// - /// Used by IDynamicTextureRender implementations to return renders - /// - /// - /// - /// - void ReturnData(UUID id, IDynamicTexture texture); + void ReturnData(UUID id, byte[] data); UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, int updateTimer); @@ -122,65 +113,11 @@ namespace OpenSim.Region.Framework.Interfaces string GetName(); string GetContentType(); bool SupportsAsynchronous(); - -// /// -// /// Return true if converting the input body and extra params data will always result in the same byte[] array -// /// -// /// -// /// This method allows the caller to use a previously generated asset if it has one. -// /// -// /// -// /// -// /// -// bool AlwaysIdenticalConversion(string bodyData, string extraParams); - - IDynamicTexture ConvertUrl(string url, string extraParams); - IDynamicTexture ConvertData(string bodyData, string extraParams); - + byte[] ConvertUrl(string url, string extraParams); + byte[] ConvertStream(Stream data, string extraParams); bool AsyncConvertUrl(UUID id, string url, string extraParams); bool AsyncConvertData(UUID id, string bodyData, string extraParams); - void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize); } - - public interface IDynamicTexture - { - /// - /// Input commands used to generate this data. - /// - /// - /// Null if input commands were not used. - /// - string InputCommands { get; } - - /// - /// Uri used to generate this data. - /// - /// - /// Null if a uri was not used. - /// - Uri InputUri { get; } - - /// - /// Extra input params used to generate this data. - /// - string InputParams { get; } - - /// - /// Texture data. - /// - byte[] Data { get; } - - /// - /// Size of texture. - /// - Size Size { get; } - - /// - /// Signal whether the texture is reuseable (i.e. whether the same input data will always generate the same - /// texture). - /// - bool IsReuseable { get; } - } } diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 8028d87..4274cbe 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -152,19 +152,6 @@ namespace OpenSim.Region.Framework.Interfaces void StopScriptInstance(UUID itemId); /// - /// Try to get the script running status. - /// - /// - /// Returns true if a script for the item was found in one of the simulator's script engines. In this case, - /// the running parameter will reflect the running status. - /// Returns false if the item could not be found, if the item is not a script or if a script instance for the - /// item was not found in any of the script engines. In this case, running status is irrelevant. - /// - /// - /// - bool TryGetScriptInstanceRunning(UUID itemId, out bool running); - - /// /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative /// name is chosen. /// @@ -283,25 +270,17 @@ namespace OpenSim.Region.Framework.Interfaces void ApplyGodPermissions(uint perms); /// - /// Number of items in this inventory. - /// - int Count { get; } - - /// /// Returns true if this inventory contains any scripts /// bool ContainsScripts(); /// - /// Number of scripts in this inventory. - /// - /// - /// Includes both running and non running scripts. - /// + /// Returns the count of scripts contained + /// int ScriptCount(); /// - /// Number of running scripts in this inventory. + /// Returns the count of running scripts contained /// int RunningScriptCount(); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 292efa4..ca2ad94 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -46,10 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void sendRegionHandshakeToAll(); void TriggerEstateInfoChange(); - - /// - /// Fires the OnRegionInfoChange event. - /// void TriggerRegionInfoChange(); void setEstateTerrainBaseTexture(int level, UUID texture); diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs index da39e95..baac6e8 100644 --- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces public interface IJsonStoreModule { - bool CreateStore(string value, ref UUID result); + bool CreateStore(string value, out UUID result); bool DestroyStore(UUID storeID); bool TestPath(UUID storeID, string path, bool useJson); bool SetValue(UUID storeID, string path, string value, bool useJson); diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index 70ff954..a76ffde 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs @@ -47,46 +47,9 @@ namespace OpenSim.Region.Framework.Interfaces /// event ScriptCommand OnScriptCommand; - /// - /// Register an instance method as a script call by method name - /// - /// - /// void RegisterScriptInvocation(object target, string method); - - /// - /// Register a static or instance method as a script call by method info - /// - /// If target is a Type object, will assume method is static. - /// void RegisterScriptInvocation(object target, MethodInfo method); - - /// - /// Register one or more instance methods as script calls by method name - /// - /// - /// void RegisterScriptInvocation(object target, string[] methods); - - /// - /// Register one or more static methods as script calls by method name - /// - /// - /// - void RegisterScriptInvocation(Type target, string[] methods); - - /// - /// Automatically register script invocations by checking for methods - /// with . Should only check - /// public methods. - /// - /// - void RegisterScriptInvocations(IRegionModuleBase target); - - /// - /// Returns an array of all registered script calls - /// - /// Delegate[] GetScriptInvocationList(); Delegate LookupScriptInvocation(string fname); @@ -105,44 +68,12 @@ namespace OpenSim.Region.Framework.Interfaces /// void DispatchReply(UUID scriptId, int code, string text, string key); - /// - /// Operation to for a region module to register a constant to be used - /// by the script engine - /// - /// - /// The name of the constant. LSL convention is for constant names to - /// be uppercase. - /// - /// - /// The value of the constant. Should be of a type that can be - /// converted to one of - /// + /// For constants void RegisterConstant(string cname, object value); - - /// - /// Automatically register all constants on a region module by - /// checking for fields with . - /// - /// - void RegisterConstants(IRegionModuleBase target); - - /// - /// Operation to check for a registered constant - /// - /// Name of constant - /// Value of constant or null if none found. object LookupModConstant(string cname); Dictionary GetConstants(); // For use ONLY by the script API void RaiseEvent(UUID script, string id, string module, string command, string key); } - - [AttributeUsage(AttributeTargets.Method)] - public class ScriptInvocationAttribute : Attribute - { } - - [AttributeUsage(AttributeTargets.Field)] - public class ScriptConstantAttribute : Attribute - { } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 68af492..6117a80 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -32,96 +32,9 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ISoundModule { - /// - /// Maximum distance between a sound source and a recipient. - /// - float MaxDistance { get; } - - /// - /// Play a sound from an object. - /// - /// Sound asset ID - /// Sound source owner - /// Sound source ID - /// Sound volume - /// Sound source position - /// Sound flags - /// - /// Radius used to affect gain over distance. - /// - void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, - double gain, Vector3 position, byte flags, float radius); - - /// - /// Trigger a sound in the scene. - /// - /// Sound asset ID - /// Sound source owner - /// Sound source ID - /// Sound source parent. - /// Sound volume - /// Sound source position - /// - /// - /// Radius used to affect gain over distance. - /// + void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); + void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, - double gain, Vector3 position, UInt64 handle, float radius); - - /// - /// Stop sounds eminating from an object. - /// - /// Sound source ID - void StopSound(UUID objectID); - - /// - /// Preload sound to viewers within range. - /// - /// Sound source ID - /// Sound asset ID - /// - /// Radius used to determine which viewers should preload the sound. - /// - void PreloadSound(UUID objectID, UUID soundID, float radius); - - /// - /// Loop specified sound at specified volume with specified radius, - /// optionally declaring object as new sync master. - /// - /// Sound source ID - /// Sound asset ID - /// Sound volume - /// Sound radius - /// Set object to sync master if true - void LoopSound(UUID objectID, UUID soundID, double gain, - double radius, bool isMaster); - - /// - /// Trigger or play an attached sound in this part's inventory. - /// - /// Sound source ID - /// Sound asset ID - /// Sound volume - /// Triggered or not. - /// - /// Sound radius - /// Play using sound master - /// Play as sound master - void SendSound(UUID objectID, UUID sound, double volume, - bool triggered, byte flags, float radius, bool useMaster, - bool isMaster); - - /// - /// Trigger a sound to be played to all agents within an axis-aligned - /// bounding box. - /// - /// Sound source ID - /// Sound asset ID - /// Sound volume - /// AABB bottom south-west corner - /// AABB top north-east corner - void TriggerSoundLimited(UUID objectID, UUID sound, double volume, - Vector3 min, Vector3 max); + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 79e9f9d..457444c 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs @@ -39,8 +39,6 @@ namespace OpenSim.Region.Framework.Interfaces UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); void ReleaseURL(string url); void HttpResponse(UUID request, int status, string body); - void HttpContentType(UUID request, string type); - string GetHttpHeader(UUID request, string header); int GetFreeUrls(); diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index f8088c3..24cd069 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -1,31 +1,4 @@ -/* - * 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; +using System; using System.Collections.Generic; using OpenMetaverse; diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 20e0199..e8e375e 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs @@ -45,13 +45,6 @@ namespace OpenSim.Region.Framework.Interfaces void Deactivate(); void Activate(); UUID GetID(); - - /// - /// Bitfield indicating which strings should be processed as regex. - /// 1 corresponds to IWorldCommListenerInfo::GetName() - /// 2 corresponds to IWorldCommListenerInfo::GetMessage() - /// - int RegexBitfield { get; } } public interface IWorldComm @@ -67,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces /// the script during 'peek' time. Parameter hostID is needed to /// determine the position of the script. /// - /// localID of the script engine + /// localID of the script engine /// UUID of the script engine /// UUID of the SceneObjectPart /// channel to listen on @@ -77,23 +70,6 @@ namespace OpenSim.Region.Framework.Interfaces /// number of the scripts handle int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); - /// - /// Create a listen event callback with the specified filters. - /// The parameters localID,itemID are needed to uniquely identify - /// the script during 'peek' time. Parameter hostID is needed to - /// determine the position of the script. - /// - /// localID of the script engine - /// UUID of the script engine - /// UUID of the SceneObjectPart - /// channel to listen on - /// name to filter on - /// key to filter on (user given, could be totally faked) - /// msg to filter on - /// Bitfield indicating which strings should be processed as regex. - /// number of the scripts handle - int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg, int regexBitfield); - /// /// This method scans over the objects which registered an interest in listen callbacks. /// For everyone it finds, it checks if it fits the given filter. If it does, then diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 65ae445..ad421ee 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -41,7 +41,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Framework.Animation m_implicitDefaultAnimation = new OpenSim.Framework.Animation(); private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); private List m_animations = new List(); @@ -50,11 +49,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation get { return m_defaultAnimation; } } - public OpenSim.Framework.Animation ImplicitDefaultAnimation - { - get { return m_implicitDefaultAnimation; } - } - public AnimationSet() { ResetDefaultAnimation(); @@ -125,18 +119,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_defaultAnimation.AnimID != animID) { m_defaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); - m_implicitDefaultAnimation = m_defaultAnimation; return true; } return false; } - // Called from serialization only - public void SetImplicitDefaultAnimation(UUID animID, int sequenceNum, UUID objectID) - { - m_implicitDefaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); - } - protected bool ResetDefaultAnimation() { return TrySetDefaultAnimation("STAND", 1, UUID.Zero); diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 5b1c9f4..4a19c3b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -47,75 +47,30 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnFrameDelegate(); - /// - /// Triggered on each sim frame. - /// - /// - /// This gets triggered in - /// Core uses it for things like Sun, Wind & Clouds - /// The MRM module also uses it. - /// public event OnFrameDelegate OnFrame; public delegate void ClientMovement(ScenePresence client); - /// - /// Trigerred when an agent moves. - /// - /// - /// This gets triggered in - /// prior to - /// public event ClientMovement OnClientMovement; public delegate void OnTerrainTaintedDelegate(); - /// - /// Triggered if the terrain has been edited - /// - /// - /// This gets triggered in - /// after it determines that an update has been made. - /// public event OnTerrainTaintedDelegate OnTerrainTainted; public delegate void OnTerrainTickDelegate(); - /// - /// Triggered if the terrain has been edited - /// - /// - /// This gets triggered in - /// but is used by core solely to update the physics engine. - /// - public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnTerrainUpdateDelegate(); + public event OnTerrainTickDelegate OnTerrainTick; + public event OnTerrainUpdateDelegate OnTerrainUpdate; public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); - /// - /// Triggered when a region is backed up/persisted to storage - /// - /// - /// This gets triggered in - /// and is fired before the persistence occurs. - /// public event OnBackupDelegate OnBackup; public delegate void OnClientConnectCoreDelegate(IClientCore client); - /// - /// Triggered when a new client connects to the scene. - /// - /// - /// This gets triggered in , - /// which checks if an instance of - /// also implements and as such, - /// is not triggered by NPCs. - /// public event OnClientConnectCoreDelegate OnClientConnect; public delegate void OnNewClientDelegate(IClientAPI client); @@ -125,96 +80,33 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// This is triggered for both child and root agent client connections. - /// /// Triggered before OnClientLogin. - /// - /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please - /// do this on a separate thread. /// public event OnNewClientDelegate OnNewClient; /// /// Fired if the client entering this sim is doing so as a new login /// - /// - /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please - /// do this on a separate thread. - /// public event Action OnClientLogin; public delegate void OnNewPresenceDelegate(ScenePresence presence); - /// - /// Triggered when a new presence is added to the scene - /// - /// - /// Triggered in which is used by both - /// users and NPCs - /// public event OnNewPresenceDelegate OnNewPresence; public delegate void OnRemovePresenceDelegate(UUID agentId); - /// - /// Triggered when a presence is removed from the scene - /// - /// - /// Triggered in which is used by both - /// users and NPCs - /// - /// Triggered under per-agent lock. So if you want to perform any long-running operations, please - /// do this on a separate thread. - /// public event OnRemovePresenceDelegate OnRemovePresence; public delegate void OnParcelPrimCountUpdateDelegate(); - /// - /// Triggered whenever the prim count may have been altered, or prior - /// to an action that requires the current prim count to be accurate. - /// - /// - /// Triggered by in - /// , - /// , - /// , - /// , - /// , - /// , - /// - /// public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); - /// - /// Triggered in response to for - /// objects that actually contribute to parcel prim count. - /// - /// - /// Triggered by in - /// - /// public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; public delegate void OnPluginConsoleDelegate(string[] args); - /// - /// Triggered after - /// has been called for all - /// loaded via . - /// Handlers for this event are typically used to parse the arguments - /// from in order to process or - /// filter the arguments and pass them onto - /// - /// - /// Triggered by in - /// via - /// via - /// via - /// via - /// - /// public event OnPluginConsoleDelegate OnPluginConsole; /// @@ -229,28 +121,8 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene); - /// - /// Triggered before the grunt work for adding a root agent to a - /// scene has been performed (resuming attachment scripts, physics, - /// animations etc.) - /// - /// - /// Triggered before - /// by - /// in - /// via - /// and - /// public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; - /// - /// Triggered after parcel properties have been updated. - /// - /// - /// Triggered by in - /// , - /// - /// public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; /// @@ -265,45 +137,13 @@ namespace OpenSim.Region.Framework.Scenes /// /// Fired when an object is touched/grabbed. /// - /// /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of /// the root part. - /// Triggerd in response to - /// via - /// in - /// public event ObjectGrabDelegate OnObjectGrab; public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); - /// - /// Triggered when an object is being touched/grabbed continuously. - /// - /// - /// Triggered in response to - /// via - /// in - /// public event ObjectGrabDelegate OnObjectGrabbing; - - /// - /// Triggered when an object stops being touched/grabbed. - /// - /// - /// Triggered in response to - /// via - /// in - /// public event ObjectDeGrabDelegate OnObjectDeGrab; - - /// - /// Triggered when a script resets. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// public event ScriptResetDelegate OnScriptReset; public event OnPermissionErrorDelegate OnPermissionError; @@ -313,105 +153,29 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// Occurs after OnNewScript. - /// Triggered by - /// in /// public event NewRezScript OnRezScript; public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); public delegate void RemoveScript(uint localID, UUID itemID); - - /// - /// Triggered when a script is removed from an object. - /// - /// - /// Triggered by - /// in , - /// , - /// , - /// - /// public event RemoveScript OnRemoveScript; public delegate void StartScript(uint localID, UUID itemID); - - /// - /// Triggered when a script starts. - /// - /// - /// Triggered by - /// in - /// via , - /// via - /// public event StartScript OnStartScript; public delegate void StopScript(uint localID, UUID itemID); - - /// - /// Triggered when a script stops. - /// - /// - /// Triggered by , - /// in , - /// , - /// - /// public event StopScript OnStopScript; public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); - - /// - /// Triggered when an object is moved. - /// - /// - /// Triggered by - /// in , - /// - /// public event SceneGroupMoved OnSceneGroupMove; public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); - - /// - /// Triggered when an object is grabbed. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// via - /// public event SceneGroupGrabed OnSceneGroupGrab; public delegate bool SceneGroupSpinStarted(UUID groupID); - - /// - /// Triggered when an object starts to spin. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event SceneGroupSpinStarted OnSceneGroupSpinStart; public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); - - /// - /// Triggered when an object is being spun. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event SceneGroupSpun OnSceneGroupSpin; public delegate void LandObjectAdded(ILandObject newParcel); @@ -440,9 +204,6 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// At the point of firing, the scene still contains the client's scene presence. - /// - /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please - /// do this on a separate thread. /// public event ClientClosed OnClientClosed; @@ -453,9 +214,6 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// Occurs before OnRezScript - /// Triggered by - /// in , - /// /// public event NewScript OnNewScript; @@ -490,12 +248,6 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. - /// Triggered by - /// in - /// via - /// via - /// via - /// via /// public event UpdateScript OnUpdateScript; @@ -521,203 +273,48 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Triggered when some scene object properties change. - /// - /// /// ScriptChangedEvent is fired when a scene object property that a script might be interested /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. /// This is not an indication that the script has changed (see OnUpdateScript for that). /// This event is sent to a script to tell it that some property changed on /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . - /// Triggered by - /// in , - /// - /// + /// public event ScriptChangedEvent OnScriptChangedEvent; public delegate void ScriptChangedEvent(uint localID, uint change); public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); - - /// - /// Triggered when a script receives control input from an agent. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptControlEvent OnScriptControlEvent; public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); - - /// - /// Triggered when an object has arrived within a tolerance distance - /// of a motion target. - /// - /// - /// Triggered by - /// in - /// via , - /// via - /// public event ScriptAtTargetEvent OnScriptAtTargetEvent; public delegate void ScriptNotAtTargetEvent(uint localID); - - /// - /// Triggered when an object has a motion target but has not arrived - /// within a tolerance distance. - /// - /// - /// Triggered by - /// in - /// via , - /// via - /// public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); - - /// - /// Triggered when an object has arrived within a tolerance rotation - /// of a rotation target. - /// - /// - /// Triggered by - /// in - /// via , - /// via - /// public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; public delegate void ScriptNotAtRotTargetEvent(uint localID); - - /// - /// Triggered when an object has a rotation target but has not arrived - /// within a tolerance rotation. - /// - /// - /// Triggered by - /// in - /// via , - /// via - /// public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; public delegate void ScriptColliding(uint localID, ColliderArgs colliders); - - /// - /// Triggered when a physical collision has started between a prim - /// and something other than the region terrain. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptColliderStart; - - /// - /// Triggered when something that previously collided with a prim has - /// not stopped colliding with it. - /// - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptColliding; - - /// - /// Triggered when something that previously collided with a prim has - /// stopped colliding with it. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptCollidingEnd; - - /// - /// Triggered when a physical collision has started between an object - /// and the region terrain. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptLandColliderStart; - - /// - /// Triggered when an object that previously collided with the region - /// terrain has not yet stopped colliding with it. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptLandColliding; - - /// - /// Triggered when an object that previously collided with the region - /// terrain has stopped colliding with it. - /// - /// - /// Triggered by - /// in - /// via - /// via - /// via - /// public event ScriptColliding OnScriptLandColliderEnd; public delegate void OnMakeChildAgentDelegate(ScenePresence presence); - - /// - /// Triggered when an agent has been made a child agent of a scene. - /// - /// - /// Triggered by - /// in - /// via , - /// , - /// - /// public event OnMakeChildAgentDelegate OnMakeChildAgent; public delegate void OnSaveNewWindlightProfileDelegate(); public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); /// - /// Triggered after the grunt work for adding a root agent to a - /// scene has been performed (resuming attachment scripts, physics, - /// animations etc.) - /// - /// /// This event is on the critical path for transferring an avatar from one region to another. Try and do /// as little work on this event as possible, or do work asynchronously. - /// Triggered after - /// by - /// in - /// via - /// and - /// + /// public event Action OnMakeRootAgent; public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; @@ -743,17 +340,9 @@ namespace OpenSim.Region.Framework.Scenes public event AvatarKillData OnAvatarKilled; public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); - /* - public delegate void ScriptTimerEvent(uint localID, double timerinterval); - /// - /// Used to be triggered when the LSL timer event fires. - /// - /// - /// Triggered by - /// via - /// - public event ScriptTimerEvent OnScriptTimerEvent; - */ +// public delegate void ScriptTimerEvent(uint localID, double timerinterval); + +// public event ScriptTimerEvent OnScriptTimerEvent; public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); @@ -763,27 +352,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// Triggered when an object is added to the scene. /// - /// - /// Triggered by - /// in , - /// , - /// - /// public event Action OnObjectAddedToScene; /// - /// Delegate for - /// - /// The object being removed from the scene - public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); - - /// /// Triggered when an object is removed from the scene. /// - /// - /// Triggered by - /// in - /// + public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; public delegate void NoticeNoLandDataFromStorage(); @@ -799,20 +373,6 @@ namespace OpenSim.Region.Framework.Scenes public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate; public delegate void ParcelPrimCountTainted(); - - /// - /// Triggered when the parcel prim count has been altered. - /// - /// - /// Triggered by in - /// , - /// , - /// , - /// , - /// , - /// , - /// - /// public event ParcelPrimCountTainted OnParcelPrimCountTainted; public event GetScriptRunning OnGetScriptRunning; @@ -876,7 +436,7 @@ namespace OpenSim.Region.Framework.Scenes /// the scripts may not have started yet /// Message is non empty string if there were problems loading the oar file /// - public delegate void OarFileLoaded(Guid guid, List loadedScenes, string message); + public delegate void OarFileLoaded(Guid guid, string message); public event OarFileLoaded OnOarFileLoaded; /// @@ -929,13 +489,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// True if the duplicate will immediately be in the scene, false otherwise - /// - /// Triggered in - /// public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); - public delegate void SceneObjectPartUpdated(SceneObjectPart sop, bool full); + public delegate void SceneObjectPartUpdated(SceneObjectPart sop); public event SceneObjectPartUpdated OnSceneObjectPartUpdated; public delegate void ScenePresenceUpdated(ScenePresence sp); @@ -973,28 +530,9 @@ namespace OpenSim.Region.Framework.Scenes public event PrimsLoaded OnPrimsLoaded; public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); - - /// - /// Triggered when a teleport starts - /// - /// - /// Triggered by - /// in - /// and - /// via - /// public event TeleportStart OnTeleportStart; public delegate void TeleportFail(IClientAPI client, bool gridLogout); - - /// - /// Trigered when a teleport fails. - /// - /// - /// Triggered by - /// in - /// via - /// public event TeleportFail OnTeleportFail; public class MoneyTransferArgs : EventArgs @@ -1002,9 +540,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID sender; public UUID receiver; - /// - /// Always false. The SL protocol sucks. - /// + // Always false. The SL protocol sucks. public bool authenticated = false; public int amount; @@ -1061,29 +597,8 @@ namespace OpenSim.Region.Framework.Scenes public delegate void LandBuy(Object sender, LandBuyArgs e); - /// - /// Triggered when an attempt to transfer grid currency occurs - /// - /// - /// Triggered in - /// via - /// via - /// via - /// public event MoneyTransferEvent OnMoneyTransfer; - - /// - /// Triggered after after - /// public event LandBuy OnLandBuy; - - /// - /// Triggered to allow or prevent a real estate transaction - /// - /// - /// Triggered in - /// - /// public event LandBuy OnValidateLandBuy; public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) @@ -2520,11 +2035,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// this lets us keep track of nasty script events like timer, etc. - /// - /// - /// + // this lets us keep track of nasty script events like timer, etc. public void TriggerTimerEvent(uint objLocalID, double Interval) { throw new NotImplementedException("TriggerTimerEvent was thought to be not used anymore and the registration for the event from scene object part has been commented out due to a memory leak"); @@ -2586,7 +2097,7 @@ namespace OpenSim.Region.Framework.Scenes return 6; } - public void TriggerOarFileLoaded(Guid requestId, List loadedScenes, string message) + public void TriggerOarFileLoaded(Guid requestId, string message) { OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; if (handlerOarFileLoaded != null) @@ -2595,7 +2106,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(requestId, loadedScenes, message); + d(requestId, message); } catch (Exception e) { @@ -2880,7 +2391,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full) + public void TriggerSceneObjectPartUpdated(SceneObjectPart sop) { SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; if (handler != null) @@ -2889,7 +2400,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(sop, full); + d(sop); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6208a57..906c1ee 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void StartScripts() { -// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); + m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); IScriptModule[] engines = RequestModuleInterfaces(); @@ -1469,7 +1469,7 @@ namespace OpenSim.Region.Framework.Scenes return newFolderID; } - public void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) + private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) { if (folder == null) return; @@ -1997,9 +1997,6 @@ namespace OpenSim.Region.Framework.Scenes // If child prims have invalid perms, fix them grp.AdjustChildPrimPermissions(); - // If child prims have invalid perms, fix them - grp.AdjustChildPrimPermissions(); - if (remoteClient == null) { // Autoreturn has a null client. Nothing else does. So diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ce6415a..e970543 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -38,20 +38,8 @@ namespace OpenSim.Region.Framework.Scenes { public partial class Scene { - /// - /// Send chat to listeners. - /// - /// - /// /param> - /// - /// - /// - /// - /// - /// - /// public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, - UUID fromID, UUID targetID, bool fromAgent, bool broadcast) + UUID fromID, bool fromAgent, bool broadcast, UUID destination) { OSChatMessage args = new OSChatMessage(); @@ -61,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes args.Position = fromPos; args.SenderUUID = fromID; args.Scene = this; - args.Destination = targetID; + args.Destination = destination; if (fromAgent) { @@ -78,10 +66,6 @@ namespace OpenSim.Region.Framework.Scenes args.From = fromName; //args. -// m_log.DebugFormat( -// "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}", -// args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast); - if (broadcast) EventManager.TriggerOnChatBroadcast(this, args); else @@ -91,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent, bool broadcast) { - SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast); + SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero); } /// @@ -559,7 +543,7 @@ namespace OpenSim.Region.Framework.Scenes if (!InventoryService.AddFolder(folder)) { m_log.WarnFormat( - "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", + "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2543333..649d545 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -80,11 +80,6 @@ namespace OpenSim.Region.Framework.Scenes public SynchronizeSceneHandler SynchronizeScene; /// - /// Used to prevent simultaneous calls to RemoveClient() for the same agent from interfering with each other. - /// - private object m_removeClientLock = new object(); - - /// /// Statistical information for this scene. /// public SimStatsReporter StatsReporter { get; private set; } @@ -108,31 +103,8 @@ namespace OpenSim.Region.Framework.Scenes /// public bool CollidablePrims { get; private set; } - /// - /// Minimum value of the size of a non-physical prim in each axis - /// - public float m_minNonphys = 0.001f; - - /// - /// Maximum value of the size of a non-physical prim in each axis - /// public float m_maxNonphys = 256; - - /// - /// Minimum value of the size of a physical prim in each axis - /// - public float m_minPhys = 0.01f; - - /// - /// Maximum value of the size of a physical prim in each axis - /// public float m_maxPhys = 10; - - /// - /// Max prims an object will hold - /// - public int m_linksetCapacity = 0; - public bool m_clampPrimSize; public bool m_trustBinaries; public bool m_allowScriptCrossings; @@ -313,31 +285,6 @@ namespace OpenSim.Region.Framework.Scenes } private volatile bool m_shuttingDown; - /// - /// Is the scene active? - /// - /// - /// If false, maintenance and update loops are not being run. Updates can still be triggered manually if - /// the scene is not active. - /// - public bool Active - { - get { return m_active; } - set - { - if (value) - { - if (!m_active) - Start(); - } - else - { - m_active = false; - } - } - } - private volatile bool m_active; - // private int m_lastUpdate; private bool m_firstHeartbeat = true; @@ -799,24 +746,12 @@ namespace OpenSim.Region.Framework.Scenes PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); - m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); - if (RegionInfo.NonphysPrimMin > 0) - { - m_minNonphys = RegionInfo.NonphysPrimMin; - } - - m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); + m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } - m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); - if (RegionInfo.PhysPrimMin > 0) - { - m_minPhys = RegionInfo.PhysPrimMin; - } - m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) @@ -824,12 +759,6 @@ namespace OpenSim.Region.Framework.Scenes m_maxPhys = RegionInfo.PhysPrimMax; } - m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); - if (RegionInfo.LinksetCapacity > 0) - { - m_linksetCapacity = RegionInfo.LinksetCapacity; - } - SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); @@ -855,6 +784,13 @@ namespace OpenSim.Region.Framework.Scenes m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); + IConfig packetConfig = m_config.Configs["PacketPool"]; + if (packetConfig != null) + { + PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); + PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); + } + m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); @@ -918,8 +854,6 @@ namespace OpenSim.Region.Framework.Scenes } // FIXME: Ultimately this should be in a module. - SendPeriodicAppearanceUpdates = true; - IConfig appearanceConfig = m_config.Configs["Appearance"]; if (appearanceConfig != null) { @@ -1217,14 +1151,6 @@ namespace OpenSim.Region.Framework.Scenes public void SetSceneCoreDebug(Dictionary options) { - if (options.ContainsKey("active")) - { - bool active; - - if (bool.TryParse(options["active"], out active)) - Active = active; - } - if (options.ContainsKey("scripting")) { bool enableScripts = true; @@ -1300,12 +1226,6 @@ namespace OpenSim.Region.Framework.Scenes // This is the method that shuts down the scene. public override void Close() { - if (m_shuttingDown) - { - m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name); - return; - } - m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); StatsReporter.Close(); @@ -1352,14 +1272,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.Debug("[SCENE]: Graph close"); m_sceneGraph.Close(); - if (!GridService.DeregisterRegion(RegionInfo.RegionID)) - m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); - - base.Close(); - - // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence. - // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can - // attempt to reference a null or disposed physics scene. if (PhysicsScene != null) { m_log.Debug("[SCENE]: Dispose Physics"); @@ -1369,6 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes phys.Dispose(); phys = null; } + + if (!GridService.DeregisterRegion(RegionInfo.RegionID)) + m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); + + // call the base class Close method. + m_log.Debug("[SCENE]: Base close"); + base.Close(); } /// @@ -1376,8 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes /// public void Start() { - m_active = true; - // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); //m_heartbeatTimer.Enabled = true; @@ -1437,7 +1354,7 @@ namespace OpenSim.Region.Framework.Scenes #region Update Methods /// - /// Activate the various loops necessary to continually update the scene. + /// Performs per-frame updates regularly /// private void Heartbeat() { @@ -1494,7 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes List coarseLocations; List avatarUUIDs; - while (!m_shuttingDown && ((endRun == null && Active) || MaintenanceRun < endRun)) + while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) { runtc = Util.EnvironmentTickCount(); ++MaintenanceRun; @@ -1556,7 +1473,7 @@ namespace OpenSim.Region.Framework.Scenes int sleepMS; int framestart; - while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) + while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) { framestart = Util.EnvironmentTickCount(); ++Frame; @@ -1755,19 +1672,15 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAtTargets() { - List objs = null; - + List objs = new List(); lock (m_groupsWithTargets) { - if (m_groupsWithTargets.Count != 0) - objs = new List(m_groupsWithTargets.Values); + foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) + objs.Add(grp); } - if (objs != null) - { - foreach (SceneObjectGroup entry in objs) - entry.checkAtTargets(); - } + foreach (SceneObjectGroup entry in objs) + entry.checkAtTargets(); } /// @@ -2280,14 +2193,10 @@ namespace OpenSim.Region.Framework.Scenes public bool AddRestoredSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) { - if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) - { + bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); + if (result) sceneObject.IsDeleted = false; - EventManager.TriggerObjectAddedToScene(sceneObject); - return true; - } - - return false; + return result; } /// @@ -2928,89 +2837,77 @@ namespace OpenSim.Region.Framework.Scenes public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) { - ScenePresence sp; - bool vialogin; - // Validation occurs in LLUDPServer - // - // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with - // each other. In practice, this does not currently occur in the code. AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); - // We lock here on AgentCircuitData to prevent a race condition between the thread adding a new connection - // and a simultaneous one that removes it (as can happen if the client is closed at a particular point - // whilst connecting). - // - // It would be easier to lock across all NewUserConnection(), AddNewClient() and - // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service - // response in some module listening to AddNewClient()) from holding up unrelated agent calls. - // - // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all - // AddNewClient() operations (though not other ops). - // In the future this can be relieved once locking per agent (not necessarily on AgentCircuitData) is improved. - lock (aCircuit) - { - vialogin - = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 - || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - - CheckHeartbeat(); - - sp = GetScenePresence(client.AgentId); + bool vialogin + = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 + || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this - // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause - // other problems, and possible the code calling AddNewClient() should ensure that no client is already - // connected. - if (sp == null) - { - m_log.DebugFormat( - "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", - client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); - - m_clientManager.Add(client); - SubscribeToClientEvents(client); - - sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); - m_eventManager.TriggerOnNewPresence(sp); - - sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; - - // The first agent upon login is a root agent by design. - // For this agent we will have to rez the attachments. - // All other AddNewClient calls find aCircuit.child to be true. - if (aCircuit.child == false) - { - // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to - // start the scripts again (since this is done in RezAttachments()). - // XXX: This is convoluted. - sp.IsChildAgent = false; - - if (AttachmentsModule != null) - Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); - } - } - else + CheckHeartbeat(); + + ScenePresence sp = GetScenePresence(client.AgentId); + + // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this + // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause + // other problems, and possible the code calling AddNewClient() should ensure that no client is already + // connected. + if (sp == null) + { + m_log.DebugFormat( + "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", + client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); + + m_clientManager.Add(client); + SubscribeToClientEvents(client); + + sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); + m_eventManager.TriggerOnNewPresence(sp); + + sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; + + // The first agent upon login is a root agent by design. + // For this agent we will have to rez the attachments. + // All other AddNewClient calls find aCircuit.child to be true. + if (aCircuit.child == false) { - m_log.WarnFormat( - "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", - sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); - } - - // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the - // client is for a root or child agent. - client.SceneAgent = sp; + // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to + // start the scripts again (since this is done in RezAttachments()). + // XXX: This is convoluted. + sp.IsChildAgent = false; - // Cache the user's name - CacheUserName(sp, aCircuit); - - EventManager.TriggerOnNewClient(client); - if (vialogin) - EventManager.TriggerOnClientLogin(client); + if (AttachmentsModule != null) + Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); + } + } + else + { + m_log.WarnFormat( + "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", + sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); } + // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the + // client is for a root or child agent. + client.SceneAgent = sp; + m_LastLogin = Util.EnvironmentTickCount(); + // Cache the user's name + CacheUserName(sp, aCircuit); + + EventManager.TriggerOnNewClient(client); + if (vialogin) + { + EventManager.TriggerOnClientLogin(client); + // Send initial parcel data +/* this is done on TriggerOnNewClient by landmanegement respective event handler + Vector3 pos = sp.AbsolutePosition; + ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); + land.SendLandUpdateToClient(client); +*/ + } + return sp; } @@ -3550,132 +3447,110 @@ namespace OpenSim.Region.Framework.Scenes { // CheckHeartbeat(); bool isChildAgent = false; - AgentCircuitData acd; + ScenePresence avatar = GetScenePresence(agentID); - lock (m_removeClientLock) + if (avatar == null) { - acd = m_authenticateHandler.GetAgentCircuitData(agentID); + m_log.WarnFormat( + "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); - if (acd == null) - { - m_log.ErrorFormat("[SCENE]: No agent circuit found for {0}, aborting Scene.RemoveClient", agentID); - return; - } - else - { - // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred - // simultaneously. - // We also need to remove by agent ID since NPCs will have no circuit code. - m_authenticateHandler.RemoveCircuit(agentID); - } + return; } - lock (acd) + try { - ScenePresence avatar = GetScenePresence(agentID); - - if (avatar == null) - { - m_log.WarnFormat( - "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); - - return; - } - - try - { - isChildAgent = avatar.IsChildAgent; + isChildAgent = avatar.IsChildAgent; - m_log.DebugFormat( - "[SCENE]: Removing {0} agent {1} {2} from {3}", - (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); - - // Don't do this to root agents, it's not nice for the viewer - if (closeChildAgents && isChildAgent) + m_log.DebugFormat( + "[SCENE]: Removing {0} agent {1} {2} from {3}", + (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); + + // Don't do this to root agents, it's not nice for the viewer + if (closeChildAgents && isChildAgent) + { + // Tell a single agent to disconnect from the region. + IEventQueue eq = RequestModuleInterface(); + if (eq != null) { - // Tell a single agent to disconnect from the region. - IEventQueue eq = RequestModuleInterface(); - if (eq != null) - { - eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); - } - else - { - avatar.ControllingClient.SendShutdownConnectionNotice(); - } + eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); } - - // Only applies to root agents. - if (avatar.ParentID != 0) + else { - avatar.StandUp(); + avatar.ControllingClient.SendShutdownConnectionNotice(); } - - m_sceneGraph.removeUserCount(!isChildAgent); - - // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop - // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI - if (closeChildAgents && CapsModule != null) - CapsModule.RemoveCaps(agentID); - -// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever -// // this method is doing is HORRIBLE!!! - // Commented pending deletion since this method no longer appears to do anything at all -// avatar.Scene.NeedSceneCacheClear(avatar.UUID); - - if (closeChildAgents && !isChildAgent) + } + + // Only applies to root agents. + if (avatar.ParentID != 0) + { + avatar.StandUp(); + } + + m_sceneGraph.removeUserCount(!isChildAgent); + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) + CapsModule.RemoveCaps(agentID); + + // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever + // this method is doing is HORRIBLE!!! + avatar.Scene.NeedSceneCacheClear(avatar.UUID); + + if (closeChildAgents && !isChildAgent) + { + List regions = avatar.KnownRegionHandles; + regions.Remove(RegionInfo.RegionHandle); + m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); + } + + m_eventManager.TriggerClientClosed(agentID, this); + m_eventManager.TriggerOnRemovePresence(agentID); + + if (!isChildAgent) + { + if (AttachmentsModule != null) { - List regions = avatar.KnownRegionHandles; - regions.Remove(RegionInfo.RegionHandle); - m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); + AttachmentsModule.DeRezAttachments(avatar); } - - m_eventManager.TriggerClientClosed(agentID, this); - m_eventManager.TriggerOnRemovePresence(agentID); - - if (!isChildAgent) - { - if (AttachmentsModule != null) + + ForEachClient( + delegate(IClientAPI client) { - AttachmentsModule.DeRezAttachments(avatar); - } + //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway + try { client.SendKillObject(avatar.RegionHandle, new List { avatar.LocalId }); } + catch (NullReferenceException) { } + }); + } - ForEachClient( - delegate(IClientAPI client) - { - //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway - try { client.SendKillObject(avatar.RegionHandle, new List { avatar.LocalId }); } - catch (NullReferenceException) { } - }); - } + // It's possible for child agents to have transactions if changes are being made cross-border. + if (AgentTransactionsModule != null) + AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); + + m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); + m_log.Debug("[Scene] The avatar has left the building"); + } + catch (Exception e) + { + m_log.Error( + string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); + } + finally + { + try + { + // Always clean these structures up so that any failure above doesn't cause them to remain in the + // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering + // the same cleanup exception continually. + m_sceneGraph.RemoveScenePresence(agentID); + m_clientManager.Remove(agentID); - // It's possible for child agents to have transactions if changes are being made cross-border. - if (AgentTransactionsModule != null) - AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); - m_log.Debug("[Scene] The avatar has left the building"); + avatar.Close(); } catch (Exception e) { m_log.Error( - string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); - } - finally - { - try - { - // Always clean these structures up so that any failure above doesn't cause them to remain in the - // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering - // the same cleanup exception continually. - m_sceneGraph.RemoveScenePresence(agentID); - m_clientManager.Remove(agentID); - - avatar.Close(); - } - catch (Exception e) - { - m_log.Error( - string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); - } + string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); } } @@ -3734,9 +3609,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// Do the work necessary to initiate a new user connection for a particular scene. + /// At the moment, this consists of setting up the caps infrastructure + /// The return bool should allow for connections to be refused, but as not all calling paths + /// take proper notice of it let, we allowed banned users in still. /// /// CircuitData of the agent who is connecting - /// /// Outputs the reason for the false response on this string /// True if the region accepts this agent. False if it does not. False will /// also return a reason. @@ -3747,20 +3624,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// Do the work necessary to initiate a new user connection for a particular scene. - /// - /// - /// The return bool should allow for connections to be refused, but as not all calling paths - /// take proper notice of it yet, we still allowed banned users in. - /// - /// At the moment this method consists of setting up the caps infrastructure + /// At the moment, this consists of setting up the caps infrastructure /// The return bool should allow for connections to be refused, but as not all calling paths /// take proper notice of it let, we allowed banned users in still. - /// - /// This method is called by the login service (in the case of login) or another simulator (in the case of region - /// cross or teleport) to initiate the connection. It is not triggered by the viewer itself - the connection - /// is activated later when the viewer sends the initial UseCircuitCodePacket UDP packet (in the case of - /// the LLUDP stack). - /// + /// /// CircuitData of the agent who is connecting /// Outputs the reason for the false response on this string /// True for normal presence. False for NPC @@ -3859,86 +3726,83 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(true, true); + sp.ControllingClient.Close(); sp = null; } - lock (agent) + + //On login test land permisions + if (vialogin) { - //On login test land permisions - if (vialogin) + IUserAccountCacheModule cache = RequestModuleInterface(); + if (cache != null) + cache.Remove(agent.firstname + " " + agent.lastname); + if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) { - IUserAccountCacheModule cache = RequestModuleInterface(); - if (cache != null) - cache.Remove(agent.firstname + " " + agent.lastname); - if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) - { - m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); - return false; - } + m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); + return false; } + } - if (sp == null) // We don't have an [child] agent here already + if (sp == null) // We don't have an [child] agent here already + { + if (requirePresenceLookup) { - if (requirePresenceLookup) - { - try - { - if (!VerifyUserPresence(agent, out reason)) - return false; - } catch (Exception e) - { - m_log.ErrorFormat( - "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); - return false; - } - } - try { - // Always check estate if this is a login. Always - // check if banned regions are to be blacked out. - if (vialogin || (!m_seeIntoBannedRegion)) - { - if (!AuthorizeUser(agent, out reason)) - return false; - } - } - catch (Exception e) + if (!VerifyUserPresence(agent, out reason)) + return false; + } catch (Exception e) { m_log.ErrorFormat( - "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); + "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); return false; } + } - m_log.InfoFormat( - "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", - RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode); - - if (CapsModule != null) + try + { + // Always check estate if this is a login. Always + // check if banned regions are to be blacked out. + if (vialogin || (!m_seeIntoBannedRegion)) { - CapsModule.SetAgentCapsSeeds(agent); - CapsModule.CreateCaps(agent.AgentID); + if (!AuthorizeUser(agent, out reason)) + return false; } } - else + catch (Exception e) { - // Let the SP know how we got here. This has a lot of interesting - // uses down the line. - sp.TeleportFlags = (TPFlags)teleportFlags; + m_log.ErrorFormat( + "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); + return false; + } - if (sp.IsChildAgent) - { - m_log.DebugFormat( - "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", - agent.AgentID, RegionInfo.RegionName); + m_log.InfoFormat( + "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", + RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, + agent.AgentID, agent.circuitcode); - sp.AdjustKnownSeeds(); + if (CapsModule != null) + { + CapsModule.SetAgentCapsSeeds(agent); + CapsModule.CreateCaps(agent.AgentID); + } + } else + { + // Let the SP know how we got here. This has a lot of interesting + // uses down the line. + sp.TeleportFlags = (TPFlags)teleportFlags; - if (CapsModule != null) - CapsModule.SetAgentCapsSeeds(agent); - } + if (sp.IsChildAgent) + { + m_log.DebugFormat( + "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", + agent.AgentID, RegionInfo.RegionName); + + sp.AdjustKnownSeeds(); + + if (CapsModule != null) + CapsModule.SetAgentCapsSeeds(agent); } } @@ -4369,9 +4233,8 @@ namespace OpenSim.Region.Framework.Scenes return false; } - // We have to wait until the viewer contacts this region - // after receiving the EnableSimulator HTTP Event Queue message. This triggers the viewer to send - // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. + // We have to wait until the viewer contacts this region after receiving EAC. + // That calls AddNewClient, which finally creates the ScenePresence ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) @@ -4466,18 +4329,15 @@ namespace OpenSim.Region.Framework.Scenes /// Tell a single agent to disconnect from the region. /// /// - /// - /// Force the agent to close even if it might be in the middle of some other operation. You do not want to - /// force unless you are absolutely sure that the agent is dead and a normal close is not working. - /// - public bool IncomingCloseAgent(UUID agentID, bool force) + /// + public bool IncomingCloseAgent(UUID agentID, bool childOnly) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { - presence.ControllingClient.Close(force, force); + presence.ControllingClient.Close(false); return true; } @@ -4683,16 +4543,6 @@ namespace OpenSim.Region.Framework.Scenes return LandChannel.GetLandObject(x, y).LandData; } - /// - /// Get LandData by position. - /// - /// - /// - public LandData GetLandData(Vector3 pos) - { - return GetLandData(pos.X, pos.Y); - } - public LandData GetLandData(uint x, uint y) { m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); @@ -4923,24 +4773,13 @@ namespace OpenSim.Region.Framework.Scenes /// Get a group via its UUID /// /// - /// null if no group with that id exists + /// null if no group with that name exists public SceneObjectGroup GetSceneObjectGroup(UUID fullID) { return m_sceneGraph.GetSceneObjectGroup(fullID); } /// - /// Get a group via its local ID - /// - /// This will only return a group if the local ID matches a root part - /// - /// null if no group with that id exists - public SceneObjectGroup GetSceneObjectGroup(uint localID) - { - return m_sceneGraph.GetSceneObjectGroup(localID); - } - - /// /// Get a group by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// @@ -4952,18 +4791,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Attempt to get the SOG via its UUID - /// - /// - /// - /// - public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog) - { - sog = GetSceneObjectGroup(fullID); - return sog != null; - } - - /// /// Get a prim by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// @@ -4995,18 +4822,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Attempt to get a prim via its UUID - /// - /// - /// - /// - public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop) - { - sop = GetSceneObjectPart(fullID); - return sop != null; - } - - /// /// Get a scene object group that contains the prim with the given local id /// /// @@ -5100,15 +4915,14 @@ namespace OpenSim.Region.Framework.Scenes client.SendRegionHandle(regionID, handle); } -// Commented pending deletion since this method no longer appears to do anything at all -// public bool NeedSceneCacheClear(UUID agentID) -// { -// IInventoryTransferModule inv = RequestModuleInterface(); -// if (inv == null) -// return true; -// -// return inv.NeedSceneCacheClear(agentID, this); -// } + public bool NeedSceneCacheClear(UUID agentID) + { + IInventoryTransferModule inv = RequestModuleInterface(); + if (inv == null) + return true; + + return inv.NeedSceneCacheClear(agentID, this); + } public void CleanTempObjects() { @@ -6062,9 +5876,6 @@ Environment.Exit(1); public string GetExtraSetting(string name) { - if (m_extraSettings == null) - return String.Empty; - string val; if (!m_extraSettings.TryGetValue(name, out val)) @@ -6075,9 +5886,6 @@ Environment.Exit(1); public void StoreExtraSetting(string name, string val) { - if (m_extraSettings == null) - return; - string oldVal; if (m_extraSettings.TryGetValue(name, out oldVal)) @@ -6095,9 +5903,6 @@ Environment.Exit(1); public void RemoveExtraSetting(string name) { - if (m_extraSettings == null) - return; - if (!m_extraSettings.ContainsKey(name)) return; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e599e90..af13b46 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -342,7 +342,7 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { - AddNewSceneObject(sceneObject, attachToBackup, false); + AddNewSceneObject(sceneObject, true, false); if (pos != null) sceneObject.AbsolutePosition = (Vector3)pos; @@ -421,9 +421,12 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 scale = part.Shape.Scale; - scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X)); - scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y)); - scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z)); + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; part.Shape.Scale = scale; } @@ -1063,30 +1066,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a group in the scene - /// - /// - /// This will only return a group if the local ID matches the root part, not other parts. - /// - /// Local id of the root part of the group - /// null if no such group was found - protected internal SceneObjectGroup GetSceneObjectGroup(uint localID) - { - lock (SceneObjectGroupsByLocalPartID) - { - if (SceneObjectGroupsByLocalPartID.ContainsKey(localID)) - { - SceneObjectGroup so = SceneObjectGroupsByLocalPartID[localID]; - - if (so.LocalId == localID) - return so; - } - } - - return null; - } - - /// /// Get a group by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dba3a61..f1b09ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -92,11 +92,7 @@ namespace OpenSim.Region.Framework.Scenes private static SceneManager m_instance = null; public static SceneManager Instance { - get { - if (m_instance == null) - m_instance = new SceneManager(); - return m_instance; - } + get { return m_instance; } } private readonly DoubleDictionary m_localScenes = new DoubleDictionary(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 74d2629..ee61de6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2747,25 +2747,6 @@ namespace OpenSim.Region.Framework.Scenes if (objectGroup == this) return; - // If the configured linkset capacity is greater than zero, - // and the new linkset would have a prim count higher than this - // value, do not link it. - if (m_scene.m_linksetCapacity > 0 && - (PrimCount + objectGroup.PrimCount) > - m_scene.m_linksetCapacity) - { - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Cannot link group with root" + - " part {0}, {1} ({2} prims) to group with root part" + - " {3}, {4} ({5} prims) because the new linkset" + - " would exceed the configured maximum of {6}", - objectGroup.RootPart.Name, objectGroup.RootPart.UUID, - objectGroup.PrimCount, RootPart.Name, RootPart.UUID, - PrimCount, m_scene.m_linksetCapacity); - - return; - } - // 'linkPart' == the root of the group being linked into this group SceneObjectPart linkPart = objectGroup.m_rootPart; @@ -3511,33 +3492,27 @@ namespace OpenSim.Region.Framework.Scenes /// public void GroupResize(Vector3 scale) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); PhysicsActor pa = m_rootPart.PhysActor; - if (Scene != null) + if (pa != null && pa.IsPhysical) { - scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); - scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); - scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); - - if (pa != null && pa.IsPhysical) - { - scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); - scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); - scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); - } + scale.X = Math.Min(scale.X, Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); } float x = (scale.X / RootPart.Scale.X); float y = (scale.Y / RootPart.Scale.Y); float z = (scale.Z / RootPart.Scale.Z); - SceneObjectPart[] parts = m_parts.GetArray(); - - if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f)) + SceneObjectPart[] parts; + if (x > 1.0f || y > 1.0f || z > 1.0f) { + parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; @@ -3550,7 +3525,7 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null && pa.IsPhysical) { - if (oldSize.X * x > Scene.m_maxPhys) + if (oldSize.X * x > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.X; a = f / x; @@ -3558,16 +3533,8 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.X * x < Scene.m_minPhys) - { - f = m_scene.m_minPhys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > Scene.m_maxPhys) + if (oldSize.Y * y > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Y; a = f / y; @@ -3575,16 +3542,8 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.Y * y < Scene.m_minPhys) - { - f = m_scene.m_minPhys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > Scene.m_maxPhys) + if (oldSize.Z * z > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Z; a = f / z; @@ -3592,18 +3551,10 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.Z * z < Scene.m_minPhys) - { - f = m_scene.m_minPhys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } } else { - if (oldSize.X * x > Scene.m_maxNonphys) + if (oldSize.X * x > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.X; a = f / x; @@ -3611,16 +3562,8 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.X * x < Scene.m_minNonphys) - { - f = m_scene.m_minNonphys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > Scene.m_maxNonphys) + if (oldSize.Y * y > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Y; a = f / y; @@ -3628,16 +3571,8 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.Y * y < Scene.m_minNonphys) - { - f = m_scene.m_minNonphys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > Scene.m_maxNonphys) + if (oldSize.Z * z > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Z; a = f / z; @@ -3645,14 +3580,6 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } - else if (oldSize.Z * z < Scene.m_minNonphys) - { - f = m_scene.m_minNonphys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } } } } @@ -3665,6 +3592,7 @@ namespace OpenSim.Region.Framework.Scenes RootPart.Resize(prevScale); + parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2191cfa..165dd85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -790,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e); + m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); } } } @@ -2864,35 +2864,6 @@ namespace OpenSim.Region.Framework.Scenes SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); } - // The Collision sounds code calls this - public void SendCollisionSound(UUID soundID, double volume, Vector3 position) - { - if (soundID == UUID.Zero) - return; - - ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); - if (soundModule == null) - return; - - if (volume > 1) - volume = 1; - if (volume < 0) - volume = 0; - - int now = Util.EnvironmentTickCount(); - if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) - return; - - LastColSoundSentTime = now; - - UUID ownerID = OwnerID; - UUID objectID = ParentGroup.RootPart.UUID; - UUID parentID = ParentGroup.UUID; - ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; - - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); - } - public void PhysicsOutOfBounds(Vector3 pos) { m_log.Error("[PHYSICS]: Physical Object went out of bounds."); @@ -2924,6 +2895,38 @@ namespace OpenSim.Region.Framework.Scenes ScheduleTerseUpdate(); } + public void PreloadSound(string sound) + { + // UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID soundID = UUID.Zero; + + if (!UUID.TryParse(sound, out soundID)) + { + //Trys to fetch sound id from prim's inventory. + //Prim's inventory doesn't support non script items yet + + TaskInventory.LockItemsForRead(true); + + foreach (KeyValuePair item in TaskInventory) + { + if (item.Value.Name == sound) + { + soundID = item.Value.ItemID; + break; + } + } + + TaskInventory.LockItemsForRead(false); + } + + ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); + } + public void RemFlag(PrimFlags flag) { // PrimFlags prevflag = Flags; @@ -2976,20 +2979,17 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); + PhysicsActor pa = PhysActor; - if (ParentGroup.Scene != null) + if (pa != null && pa.IsPhysical) { - scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); - scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); - scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); - - if (pa != null && pa.IsPhysical) - { - scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); - scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); - scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); - } + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); } // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); @@ -3086,7 +3086,7 @@ namespace OpenSim.Region.Framework.Scenes // UUID, Name, TimeStampFull); if (ParentGroup.Scene != null) - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true); + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); } /// @@ -3120,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes } if (ParentGroup.Scene != null) - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false); + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); } public void ScriptSetPhysicsStatus(bool UsePhysics) @@ -3295,6 +3295,126 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Trigger or play an attached sound in this part's inventory. + /// + /// + /// + /// + /// + public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) + { + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID parentID = ParentGroup.UUID; + + UUID soundID = UUID.Zero; + Vector3 position = AbsolutePosition; // region local + ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + + if (!UUID.TryParse(sound, out soundID)) + { + // search sound file from inventory + TaskInventory.LockItemsForRead(true); + foreach (KeyValuePair item in TaskInventory) + { + if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) + { + soundID = item.Value.ItemID; + break; + } + } + TaskInventory.LockItemsForRead(false); + } + + if (soundID == UUID.Zero) + return; + + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule != null) + { + if (useMaster) + { + if (isMaster) + { + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + ParentGroup.PlaySoundMasterPrim = this; + ownerID = OwnerID; + objectID = ParentGroup.RootPart.UUID; + parentID = ParentGroup.UUID; + position = AbsolutePosition; // region local + regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) + { + ownerID = prim.OwnerID; + objectID = prim.ParentGroup.RootPart.UUID; + parentID = prim.ParentGroup.UUID; + position = prim.AbsolutePosition; // region local + regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + } + ParentGroup.PlaySoundSlavePrims.Clear(); + ParentGroup.PlaySoundMasterPrim = null; + } + else + { + ParentGroup.PlaySoundSlavePrims.Add(this); + } + } + else + { + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + } + } + } + + public void SendCollisionSound(UUID soundID, double volume, Vector3 position) + { + if (soundID == UUID.Zero) + return; + + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule == null) + return; + + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + int now = Util.EnvironmentTickCount(); + if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) + return; + + LastColSoundSentTime = now; + + UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID parentID = ParentGroup.UUID; + ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); + } + + + /// /// Send a terse update to all clients /// public void SendTerseUpdateToAllClients() @@ -3455,32 +3575,23 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Set the color & alpha of prim faces + /// Set the color of prim faces /// - /// /// - /// - public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha) + /// + public void SetFaceColor(Vector3 color, int face) { - Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); - float clippedAlpha = alpha.HasValue ? - Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0; - // The only way to get a deep copy/ If we don't do this, we can - // never detect color changes further down. + // mever detect color changes further down. Byte[] buf = Shape.Textures.GetBytes(); Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); Color4 texcolor; if (face >= 0 && face < GetNumberOfSides()) { texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - if (alpha.HasValue) - { - texcolor.A = clippedAlpha; - } + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.FaceTextures[face].RGBA = texcolor; UpdateTextureEntry(tex.GetBytes()); return; @@ -3492,23 +3603,15 @@ namespace OpenSim.Region.Framework.Scenes if (tex.FaceTextures[i] != null) { texcolor = tex.FaceTextures[i].RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - if (alpha.HasValue) - { - texcolor.A = clippedAlpha; - } + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.FaceTextures[i].RGBA = texcolor; } texcolor = tex.DefaultTexture.RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - if (alpha.HasValue) - { - texcolor.A = clippedAlpha; - } + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.DefaultTexture.RGBA = texcolor; } UpdateTextureEntry(tex.GetBytes()); @@ -4796,57 +4899,6 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } - public void UpdateSlice(float begin, float end) - { - if (end < begin) - { - float temp = begin; - begin = end; - end = temp; - } - end = Math.Min(1f, Math.Max(0f, end)); - begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f); - if (begin < 0.02f && end < 0.02f) - { - begin = 0f; - end = 0.02f; - } - - ushort uBegin = (ushort)(50000.0 * begin); - ushort uEnd = (ushort)(50000.0 * (1f - end)); - bool updatePossiblyNeeded = false; - PrimType primType = GetPrimType(); - if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING) - { - if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd) - { - m_shape.ProfileBegin = uBegin; - m_shape.ProfileEnd = uEnd; - updatePossiblyNeeded = true; - } - } - else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd) - { - m_shape.PathBegin = uBegin; - m_shape.PathEnd = uEnd; - updatePossiblyNeeded = true; - } - - if (updatePossiblyNeeded && ParentGroup != null) - { - ParentGroup.HasGroupChanged = true; - } - if (updatePossiblyNeeded && PhysActor != null) - { - PhysActor.Shape = m_shape; - ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); - } - if (updatePossiblyNeeded) - { - ScheduleFullUpdate(); - } - } - /// /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics /// engine can use it. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3a9a146..e010864 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -97,15 +97,6 @@ namespace OpenSim.Region.Framework.Scenes QueryScriptStates(); } } - - public int Count - { - get - { - lock (m_items) - return m_items.Count; - } - } /// /// Constructor @@ -244,52 +235,31 @@ namespace OpenSim.Region.Framework.Scenes if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) return; + IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); + if (engines == null) // No engine at all + return; + Items.LockItemsForRead(true); foreach (TaskInventoryItem item in Items.Values) { if (item.InvType == (int)InventoryType.LSL) { - bool running; - if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running)) - item.ScriptRunning = running; + foreach (IScriptModule e in engines) + { + bool running; + + if (e.HasScript(item.ItemID, out running)) + { + item.ScriptRunning = running; + break; + } + } } } Items.LockItemsForRead(false); } - public bool TryGetScriptInstanceRunning(UUID itemId, out bool running) - { - running = false; - - TaskInventoryItem item = GetInventoryItem(itemId); - - if (item == null) - return false; - - return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running); - } - - public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running) - { - running = false; - - if (item.InvType != (int)InventoryType.LSL) - return false; - - IScriptModule[] engines = scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all - return false; - - foreach (IScriptModule e in engines) - { - if (e.HasScript(item.ItemID, out running)) - return true; - } - - return false; - } - public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) { int scriptsValidForStarting = 0; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 25a53b4..2b9665c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -69,15 +69,14 @@ namespace OpenSim.Region.Framework.Scenes public ScriptControlled eventControls; } - public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List coarseLocations, List avatarUUIDs); + public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List coarseLocations, List avatarUUIDs); public class ScenePresence : EntityBase, IScenePresence { // ~ScenePresence() // { -// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); +// m_log.Debug("[SCENE PRESENCE] Destructor called"); // } - private void TriggerScenePresenceUpdated() { if (m_scene != null) @@ -189,7 +188,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool SitGround { get; private set; } - private SendCoarseLocationsMethod m_sendCoarseLocationsMethod; + private SendCourseLocationsMethod m_sendCourseLocationsMethod; //private Vector3 m_requestedSitOffset = new Vector3(); @@ -547,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - PhysicsActor.TargetVelocity = value; + PhysicsActor.Velocity = value; } catch (Exception e) { @@ -712,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; - m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; + m_sendCourseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); PresenceType = type; DrawDistance = world.DefaultDrawDistance; @@ -976,9 +975,7 @@ namespace OpenSim.Region.Framework.Scenes { if (wasChild && HasAttachments()) { - m_log.DebugFormat( - "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - + m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); // Resume scripts Util.FireAndForget(delegate(object x) { foreach (SceneObjectGroup sog in m_attachments) @@ -1534,22 +1531,17 @@ namespace OpenSim.Region.Framework.Scenes bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; - bool newFlying = actor.Flying; + bool oldflying = Flying; if (ForceFly) - newFlying = true; + actor.Flying = true; else if (FlyDisabled) - newFlying = false; + actor.Flying = false; else - newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); + actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); - if (actor.Flying != newFlying) - { - // Note: ScenePresence.Flying is actually fetched from the physical actor - // so setting PhysActor.Flying here also sets the ScenePresence's value. - actor.Flying = newFlying; + if (actor.Flying != oldflying) update_movementflag = true; - } if (ParentID == 0) { @@ -2631,17 +2623,17 @@ namespace OpenSim.Region.Framework.Scenes public void SendCoarseLocations(List coarseLocations, List avatarUUIDs) { - SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod; + SendCourseLocationsMethod d = m_sendCourseLocationsMethod; if (d != null) { d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); } } - public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d) + public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) { if (d != null) - m_sendCoarseLocationsMethod = d; + m_sendCourseLocationsMethod = d; } public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List coarseLocations, List avatarUUIDs) @@ -2845,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes #region Significant Movement Method /// - /// This checks for a significant movement and sends a coarselocationchange update + /// This checks for a significant movement and sends a courselocationchange update /// protected void CheckForSignificantMovement() { @@ -3282,7 +3274,6 @@ namespace OpenSim.Region.Framework.Scenes } catch { } cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; - cAgent.AnimState = Animator.Animations.ImplicitDefaultAnimation; if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(this, cAgent); @@ -3359,8 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes Animator.Animations.FromArray(cAgent.Anims); if (cAgent.DefaultAnim != null) Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); - if (cAgent.AnimState != null) - Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(cAgent, this); @@ -3643,16 +3632,13 @@ namespace OpenSim.Region.Framework.Scenes public List GetAttachments(uint attachmentPoint) { List attachments = new List(); - - if (attachmentPoint >= 0) + + lock (m_attachments) { - lock (m_attachments) + foreach (SceneObjectGroup so in m_attachments) { - foreach (SceneObjectGroup so in m_attachments) - { - if (attachmentPoint == so.AttachmentPoint) - attachments.Add(so); - } + if (attachmentPoint == so.AttachmentPoint) + attachments.Add(so); } } diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 5398ab9..756b1f4 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -47,7 +47,6 @@ namespace OpenSim.Region.Framework.Scenes = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; - public const string SlowFramesStatName = "SlowFrames"; public delegate void SendStatResult(SimStats stats); @@ -130,16 +129,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME - /// - public Stat SlowFramesStat { get; private set; } - - /// - /// The threshold at which we log a slow frame. - /// - public int SlowFramesStatReportThreshold { get; private set; } - - /// /// Extra sim statistics that are used by monitors but not sent to the client. /// /// @@ -237,24 +226,6 @@ namespace OpenSim.Region.Framework.Scenes if (StatsManager.SimExtraStats != null) OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; - - /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit - /// longer than ideal (which in itself is a concern). - SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); - - SlowFramesStat - = new Stat( - "SlowFrames", - "Slow Frames", - "Number of frames where frame time has been significantly longer than the desired frame time.", - " frames", - "scene", - m_scene.Name, - StatType.Push, - null, - StatVerbosity.Info); - - StatsManager.RegisterStat(SlowFramesStat); } public void Close() @@ -472,7 +443,6 @@ namespace OpenSim.Region.Framework.Scenes lock (m_lastReportedExtraSimStats) { m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; - m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; Dictionary physicsStats = m_scene.PhysicsScene.GetStats(); @@ -593,11 +563,6 @@ namespace OpenSim.Region.Framework.Scenes public void addFrameMS(int ms) { m_frameMS += ms; - - // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit - // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern). - if (ms > SlowFramesStatReportThreshold) - SlowFramesStat.Value++; } public void addNetMS(int ms) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 5faf131..5758869 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestScene scene = new SceneHelpers().SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); - scene.IncomingCloseAgent(sp.UUID, false); + scene.IncomingCloseAgent(sp.UUID); Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index ac3da1e..d722a09 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -65,22 +65,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(scene.Frame, Is.EqualTo(1)); } - - [Test] - public void TestShutdownScene() - { - TestHelpers.InMethod(); - - Scene scene = new SceneHelpers().SetupScene(); - scene.Close(); - - Assert.That(scene.ShuttingDown, Is.True); - Assert.That(scene.Active, Is.False); - - // Trying to update a shutdown scene should result in no update - scene.Update(1); - - Assert.That(scene.Frame, Is.EqualTo(0)); - } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 9457ebb..44d2d45 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -50,41 +50,9 @@ using OpenSim.Tests.Common.Mock; namespace OpenSim.Region.Framework.Tests { [TestFixture] - public class UserInventoryTests : OpenSimTestCase + public class UserInventoryTests { [Test] - public void TestCreateInventoryFolders() - { - TestHelpers.InMethod(); -// TestHelpers.EnableLogging(); - - // For this test both folders will have the same name which is legal in SL user inventories. - string foldersName = "f1"; - - Scene scene = new SceneHelpers().SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); - - UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); - - List oneFolder - = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); - - Assert.That(oneFolder.Count, Is.EqualTo(1)); - InventoryFolderBase firstRetrievedFolder = oneFolder[0]; - Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); - - UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); - - List twoFolders - = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); - - Assert.That(twoFolders.Count, Is.EqualTo(2)); - Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName)); - Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName)); - Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID)); - } - - [Test] public void TestGiveInventoryItem() { TestHelpers.InMethod(); @@ -115,7 +83,7 @@ namespace OpenSim.Region.Framework.Tests public void TestGiveInventoryFolder() { TestHelpers.InMethod(); -// TestHelpers.EnableLogging(); +// log4net.Config.XmlConfigurator.Configure(); Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 2279e62..411e421 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -52,23 +52,26 @@ namespace OpenSim.Region.Framework.Scenes public class UuidGatherer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Asset cache used for gathering assets + /// + protected IAssetService m_assetCache; + + /// + /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate + /// asset was found by the asset service. + /// + private AssetBase m_requestedObjectAsset; - protected IAssetService m_assetService; - -// /// -// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate -// /// asset was found by the asset service. -// /// -// private AssetBase m_requestedObjectAsset; -// -// /// -// /// Signal whether we are currently waiting for the asset service to deliver an asset. -// /// -// private bool m_waitingForObjectAsset; + /// + /// Signal whether we are currently waiting for the asset service to deliver an asset. + /// + private bool m_waitingForObjectAsset; - public UuidGatherer(IAssetService assetService) + public UuidGatherer(IAssetService assetCache) { - m_assetService = assetService; + m_assetCache = assetCache; } /// @@ -188,18 +191,18 @@ namespace OpenSim.Region.Framework.Scenes } } -// /// -// /// The callback made when we request the asset for an object from the asset service. -// /// -// private void AssetReceived(string id, Object sender, AssetBase asset) -// { -// lock (this) -// { -// m_requestedObjectAsset = asset; -// m_waitingForObjectAsset = false; -// Monitor.Pulse(this); -// } -// } + /// + /// The callback made when we request the asset for an object from the asset service. + /// + private void AssetReceived(string id, Object sender, AssetBase asset) + { + lock (this) + { + m_requestedObjectAsset = asset; + m_waitingForObjectAsset = false; + Monitor.Pulse(this); + } + } /// /// Get an asset synchronously, potentially using an asynchronous callback. If the @@ -209,29 +212,25 @@ namespace OpenSim.Region.Framework.Scenes /// protected virtual AssetBase GetAsset(UUID uuid) { - return m_assetService.Get(uuid.ToString()); + m_waitingForObjectAsset = true; + m_assetCache.Get(uuid.ToString(), this, AssetReceived); + + // The asset cache callback can either + // + // 1. Complete on the same thread (if the asset is already in the cache) or + // 2. Come in via a different thread (if we need to go fetch it). + // + // The code below handles both these alternatives. + lock (this) + { + if (m_waitingForObjectAsset) + { + Monitor.Wait(this); + m_waitingForObjectAsset = false; + } + } - // XXX: Switching to do this synchronously where the call was async before but we always waited for it - // to complete anyway! -// m_waitingForObjectAsset = true; -// m_assetCache.Get(uuid.ToString(), this, AssetReceived); -// -// // The asset cache callback can either -// // -// // 1. Complete on the same thread (if the asset is already in the cache) or -// // 2. Come in via a different thread (if we need to go fetch it). -// // -// // The code below handles both these alternatives. -// lock (this) -// { -// if (m_waitingForObjectAsset) -// { -// Monitor.Wait(this); -// m_waitingForObjectAsset = false; -// } -// } -// -// return m_requestedObjectAsset; + return m_requestedObjectAsset; } /// @@ -362,47 +361,4 @@ namespace OpenSim.Region.Framework.Scenes } } } - - public class HGUuidGatherer : UuidGatherer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected string m_assetServerURL; - - public HGUuidGatherer(IAssetService assetService, string assetServerURL) - : base(assetService) - { - m_assetServerURL = assetServerURL; - if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) - m_assetServerURL = m_assetServerURL + "/"; - } - - protected override AssetBase GetAsset(UUID uuid) - { - if (string.Empty == m_assetServerURL) - return base.GetAsset(uuid); - else - return FetchAsset(uuid); - } - - public AssetBase FetchAsset(UUID assetID) - { - - // Test if it's already here - AssetBase asset = m_assetService.Get(assetID.ToString()); - if (asset == null) - { - // It's not, so fetch it from abroad - asset = m_assetService.Get(m_assetServerURL + assetID.ToString()); - if (asset != null) - m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL); - else - m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL); - } - //else - // m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL); - - return asset; - } - } } -- cgit v1.1