* More scripting enhancemnents and properties.

afrisby
Adam Frisby 2007-07-15 22:36:35 +00:00
parent 4dbad04b9f
commit 571bd78e58
4 changed files with 62 additions and 3 deletions

View File

@ -81,6 +81,14 @@ namespace OpenSim.Region.Environment.Scenes
} }
public PrimitiveBaseShape Shape
{
get
{
return this.m_Shape;
}
}
public LLVector3 WorldPos public LLVector3 WorldPos
{ {
get get

View File

@ -112,6 +112,11 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_scriptManager; } get { return m_scriptManager; }
} }
public Dictionary<LLUUID, SceneObject> Objects
{
get { return Prims; }
}
#endregion #endregion
#region Constructors #region Constructors

View File

@ -75,6 +75,14 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public Dictionary<LLUUID, Primitive> Children
{
get
{
return this.ChildPrimitives;
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -3,6 +3,9 @@ using OpenSim.Framework;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using libsecondlife;
namespace OpenSim.Region.Scripting.Examples namespace OpenSim.Region.Scripting.Examples
{ {
public class LSLExportScript : IScript public class LSLExportScript : IScript
@ -18,15 +21,50 @@ namespace OpenSim.Region.Scripting.Examples
{ {
script = scriptInfo; script = scriptInfo;
script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(events_OnScriptConsole); script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
} }
void events_OnScriptConsole(string[] args) void ProcessConsoleMsg(string[] args)
{ {
if (args[0].ToLower() == "lslexport") if (args[0].ToLower() == "lslexport")
{ {
string sequence = "";
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
{
SceneObject root = obj.Value;
sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n";
string rootPrim = processPrimitiveToString(root.rootPrimitive);
sequence += "ROOT:" + rootPrim;
foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
{
string child = processPrimitiveToString(prim.Value);
sequence += "CHILD:" + child;
} }
} }
System.Console.WriteLine(sequence);
}
}
string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim)
{
string desc = prim.Description;
string name = prim.Name;
LLVector3 pos = prim.Pos;
LLVector3 rot = new LLVector3();
LLVector3 scale = prim.Scale;
LLVector3 rootPos = prim.WorldPos;
string setPrimParams = "";
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
return setPrimParams;
}
} }
} }