* More scripting enhancemnents and properties.
parent
4dbad04b9f
commit
571bd78e58
|
@ -81,6 +81,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
}
|
||||
|
||||
public PrimitiveBaseShape Shape
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Shape;
|
||||
}
|
||||
}
|
||||
|
||||
public LLVector3 WorldPos
|
||||
{
|
||||
get
|
||||
|
|
|
@ -112,6 +112,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
get { return m_scriptManager; }
|
||||
}
|
||||
|
||||
public Dictionary<LLUUID, SceneObject> Objects
|
||||
{
|
||||
get { return Prims; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
|
|
@ -75,6 +75,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public Dictionary<LLUUID, Primitive> Children
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ChildPrimitives;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -3,6 +3,9 @@ using OpenSim.Framework;
|
|||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Region.Scripting.Examples
|
||||
{
|
||||
public class LSLExportScript : IScript
|
||||
|
@ -18,15 +21,50 @@ namespace OpenSim.Region.Scripting.Examples
|
|||
{
|
||||
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")
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue