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. --- .../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 +- 5 files changed, 107 insertions(+), 3 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 (limited to 'OpenSim/Region') 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); -- cgit v1.1