From 1e3e2394b173c762bb260505ad89ca4708a37900 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 10 Jul 2020 18:06:44 +0200 Subject: [PATCH] use script engine osGetNotecard --- prebuild.xml | 3 +++ src/Appearance2Avatar.cs | 27 ++++++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/prebuild.xml b/prebuild.xml index ff70498..af0ac3a 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -28,6 +28,9 @@ + + + diff --git a/src/Appearance2Avatar.cs b/src/Appearance2Avatar.cs index 3726d39..90085f0 100644 --- a/src/Appearance2Avatar.cs +++ b/src/Appearance2Avatar.cs @@ -7,6 +7,9 @@ using OpenSim.Framework; using OpenSim.Modules.Appearance2Avatar.helper; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Interfaces; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using System; using System.Collections.Generic; using System.Linq; @@ -68,25 +71,12 @@ namespace OpenSim.Modules.Appearance2Avatar } - protected string LoadNotecard(UUID assetID) + protected string LoadNotecard(SceneObjectPart host, String notecardname) { - if (assetID != UUID.Zero) - { - StringBuilder notecardData = new StringBuilder(); + IScriptEngine wComm = m_scene.RequestModuleInterface(); - for (int count = 0; count < NotecardCache.GetLines(assetID); count++) - { - string line = NotecardCache.GetLine(assetID, count) + "\n"; - - // m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); - - notecardData.Append(line); - } - - return notecardData.ToString(); - } - - return null; + IOSSL_Api _api = (IOSSL_Api)wComm.GetApi(host.UUID, "LSL"); + return _api.osGetNotecard(notecardname); } [ScriptInvocation] @@ -105,13 +95,12 @@ namespace OpenSim.Modules.Appearance2Avatar { if (notecardItem.Type != 7) { - m_log.Error("[" + Name + "] ERROR: Given item is not a notecard"); throw new Exception("Given item is not a notecard."); return; } m_log.Info("[" + Name + "] Info: Fetch asset data for notecard."); - String asset = LoadNotecard(notecardItem.AssetID); + String asset = LoadNotecard(_host, notecard); if (asset != null) {