From f6f3737fe8c2ee77d127fb26d1674590ca0ced37 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 12 Apr 2009 02:42:05 +0000 Subject: [PATCH] Fix a regression where animations would only be sent if the avatar has attachments. Convert base types to LSL types for event marshalling through IScriptModule to avoid parameter errors. --- .../Region/Framework/Scenes/ScenePresence.cs | 2 +- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 38 ++++++++++++++++++- .../Region/ScriptEngine/XEngine/XEngine.cs | 38 ++++++++++++++++++- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d06c5838fb..e5ddeb5222 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1961,10 +1961,10 @@ namespace OpenSim.Region.Framework.Scenes { m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] {16384}); } - SendAnimPack(); } } } + SendAnimPack(); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index c3b52dfec2..23acc08cd6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -219,7 +219,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public bool PostScriptEvent(UUID itemID, string name, Object[] p) { - return PostScriptEvent(itemID, new EventParams(name, p, new DetectParams[0])); + Object[] lsl_p = new Object[p.Length]; + for (int i = 0; i < p.Length ; i++) + { + if (p[i] is int) + lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]); + else if (p[i] is string) + lsl_p[i] = new LSL_Types.LSLString((string)p[i]); + else if (p[i] is Vector3) + lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); + else if (p[i] is Quaternion) + lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); + else if (p[i] is float) + lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else + lsl_p[i] = p[i]; + } + + return PostScriptEvent(itemID, new EventParams(name, lsl_p, new DetectParams[0])); } public bool PostObjectEvent(UUID itemID, string name, Object[] p) @@ -228,7 +245,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine if (part == null) return false; - return PostObjectEvent(part.LocalId, new EventParams(name, p, new DetectParams[0])); + Object[] lsl_p = new Object[p.Length]; + for (int i = 0; i < p.Length ; i++) + { + if (p[i] is int) + lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]); + else if (p[i] is string) + lsl_p[i] = new LSL_Types.LSLString((string)p[i]); + else if (p[i] is Vector3) + lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); + else if (p[i] is Quaternion) + lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); + else if (p[i] is float) + lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else + lsl_p[i] = p[i]; + } + + return PostObjectEvent(part.LocalId, new EventParams(name, lsl_p, new DetectParams[0])); } public DetectParams GetDetectParams(UUID itemID, int number) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index f47e57daa9..5317cf1be1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -935,7 +935,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine public bool PostScriptEvent(UUID itemID, string name, Object[] p) { - return PostScriptEvent(itemID, new EventParams(name, p, new DetectParams[0])); + Object[] lsl_p = new Object[p.Length]; + for (int i = 0; i < p.Length ; i++) + { + if (p[i] is int) + lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]); + else if (p[i] is string) + lsl_p[i] = new LSL_Types.LSLString((string)p[i]); + else if (p[i] is Vector3) + lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); + else if (p[i] is Quaternion) + lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); + else if (p[i] is float) + lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else + lsl_p[i] = p[i]; + } + + return PostScriptEvent(itemID, new EventParams(name, lsl_p, new DetectParams[0])); } public bool PostObjectEvent(UUID itemID, string name, Object[] p) @@ -944,7 +961,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (part == null) return false; - return PostObjectEvent(part.LocalId, new EventParams(name, p, new DetectParams[0])); + Object[] lsl_p = new Object[p.Length]; + for (int i = 0; i < p.Length ; i++) + { + if (p[i] is int) + lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]); + else if (p[i] is string) + lsl_p[i] = new LSL_Types.LSLString((string)p[i]); + else if (p[i] is Vector3) + lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); + else if (p[i] is Quaternion) + lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); + else if (p[i] is float) + lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else + lsl_p[i] = p[i]; + } + + return PostObjectEvent(part.LocalId, new EventParams(name, lsl_p, new DetectParams[0])); } public Assembly OnAssemblyResolve(object sender,