From 80cbd468ea4dca31c0bf28607f4ab3ed3963f765 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 8 May 2008 04:34:02 +0000 Subject: * Some refactorings. * Added shell of new Python scripting engine. Similar in design to the one used by Rex, but will be structured at a region rather than object level, also is a region module. --- OpenSim/Grid/UserServer/Main.cs | 2 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 3 +- .../Modules/Python/Properties/AssemblyInfo.cs | 36 ++++++++++++++++ OpenSim/Region/Modules/Python/PythonAPI/Console.cs | 21 +++++++++ OpenSim/Region/Modules/Python/PythonModule.cs | 48 +++++++++++++++++++++ .../Common/ScriptEngineBase/ScriptManager.cs | 2 +- ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | 12 ++++-- ThirdPartyLicenses/IronPython.txt | 28 ++++++++++++ bin/IronMath.dll | Bin 0 -> 45056 bytes bin/IronPython.dll | Bin 0 -> 1605632 bytes prebuild.xml | 28 ++++++++++++ 11 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Modules/Python/PythonAPI/Console.cs create mode 100644 OpenSim/Region/Modules/Python/PythonModule.cs create mode 100644 ThirdPartyLicenses/IronPython.txt create mode 100644 bin/IronMath.dll create mode 100644 bin/IronPython.dll diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index d60c205..b6f59e1 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -195,7 +195,7 @@ namespace OpenSim.Grid.UserServer } } - catch (WebException e) + catch (WebException) { m_log.ErrorFormat( "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 41d9abf..0ea7e0a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2862,8 +2862,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void RegisterLocalPacketHandlers() { AddLocalPacketHandler(PacketType.LogoutRequest, Logout); - //BUG: Causes NullReferenceException FIXME. -// AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); + AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); diff --git a/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs b/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e4d7852 --- /dev/null +++ b/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Python")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Python")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5bd55f67-385d-4a43-893a-b5d2ea43f07d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Modules/Python/PythonAPI/Console.cs b/OpenSim/Region/Modules/Python/PythonAPI/Console.cs new file mode 100644 index 0000000..0d23dc6 --- /dev/null +++ b/OpenSim/Region/Modules/Python/PythonAPI/Console.cs @@ -0,0 +1,21 @@ +using System; +using System.Reflection; +using log4net; + +namespace OpenSim.Region.Modules.Python.PythonAPI +{ + class Console + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public void WriteLine(string txt) + { + m_log.Info(txt); + } + + public void WriteLine(string txt, params Object[] e) + { + m_log.Info(String.Format(txt, e)); + } + } +} diff --git a/OpenSim/Region/Modules/Python/PythonModule.cs b/OpenSim/Region/Modules/Python/PythonModule.cs new file mode 100644 index 0000000..142a7df --- /dev/null +++ b/OpenSim/Region/Modules/Python/PythonModule.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Security.Policy; +using System.Text; +using IronPython.Hosting; +using log4net; +using Nini.Config; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.Modules.Python +{ + class PythonModule : IRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private PythonEngine m_python; + + public void Initialise(Scene scene, IConfigSource source) + { + + } + + public void PostInitialise() + { + /* + m_log.Info("[PYTHON] Initialising IronPython engine."); + m_python = new PythonEngine(); + m_python.AddToPath(System.Environment.CurrentDirectory + System.IO.Path.DirectorySeparatorChar + "Python"); + */ + } + + public void Close() + { + + } + + public string Name + { + get { return "PythonModule"; } + } + + public bool IsSharedModule + { + get { return true; } + } + } +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index f5de967..9d1cd6c 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs @@ -138,8 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } } - private static int privateThreadCount = 0; // TODO: unused +// private static int privateThreadCount = 0; // private Thread StartScriptLoadUnloadThread() // { // Thread t = new Thread(ScriptLoadUnloadThreadLoop); diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs index 4440db1..3ef0ef7 100644 --- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs +++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs @@ -1007,10 +1007,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer m_log.ErrorFormat("[SPLITSCENE] [LocalUpdatePacket] ScenePresence is missing... ({0})", agentID.ToString()); return; } - - if (((LLClientView) pre.ControllingClient).IsActive) + if (pre.ControllingClient is LLClientView) { - pre.ControllingClient.OutPacket(packet, throttlePacketType); + if (((LLClientView)pre.ControllingClient).IsActive) + { + ((LLClientView)pre.ControllingClient).OutPacket(packet, throttlePacketType); + } + else + { + PacketPool.Instance.ReturnPacket(packet); + } } else { diff --git a/ThirdPartyLicenses/IronPython.txt b/ThirdPartyLicenses/IronPython.txt new file mode 100644 index 0000000..9bcb812 --- /dev/null +++ b/ThirdPartyLicenses/IronPython.txt @@ -0,0 +1,28 @@ +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. +1. Definitions + +The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law. + +A “contribution” is the original software, or any additions or changes to the software. + +A “contributor” is any person that distributes its contribution under this license. + +“Licensed patents” are a contributor’s patent claims that read directly on its contribution. +2. Grant of Rights + +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +3. Conditions and Limitations + +(A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks. + +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + +(E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. + +See FAQ.html for answers to frequently asked questions about this license. diff --git a/bin/IronMath.dll b/bin/IronMath.dll new file mode 100644 index 0000000..4960cc6 Binary files /dev/null and b/bin/IronMath.dll differ diff --git a/bin/IronPython.dll b/bin/IronPython.dll new file mode 100644 index 0000000..2efe7ef Binary files /dev/null and b/bin/IronPython.dll differ diff --git a/prebuild.xml b/prebuild.xml index 474e514..0b84c6b 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -863,6 +863,34 @@ + + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + -- cgit v1.1