use LoadNotecard
parent
e6039c53f3
commit
c5cc87e10d
|
@ -4,6 +4,7 @@ using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Modules.Appearance2Avatar.helper;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using System;
|
using System;
|
||||||
|
@ -19,13 +20,12 @@ namespace OpenSim.Modules.Appearance2Avatar
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Appearance2Avatar")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Appearance2Avatar")]
|
||||||
|
|
||||||
class Appearance2Avatar : INonSharedRegionModule
|
public class Appearance2Avatar : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
|
||||||
private IScriptModuleComms m_scriptModule = null;
|
private IScriptModuleComms m_scriptModule = null;
|
||||||
private Scene m_scene = null;
|
public static Scene m_scene = null;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,27 @@ namespace OpenSim.Modules.Appearance2Avatar
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected string LoadNotecard(UUID assetID)
|
||||||
|
{
|
||||||
|
if (assetID != UUID.Zero)
|
||||||
|
{
|
||||||
|
StringBuilder notecardData = new StringBuilder();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
[ScriptInvocation]
|
[ScriptInvocation]
|
||||||
public void osAppearance2Avatar(UUID hostID, UUID scriptID, String notecard, String targetAvatar)
|
public void osAppearance2Avatar(UUID hostID, UUID scriptID, String notecard, String targetAvatar)
|
||||||
{
|
{
|
||||||
|
@ -90,16 +111,14 @@ namespace OpenSim.Modules.Appearance2Avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[" + Name + "] Info: Fetch asset data for notecard.");
|
m_log.Info("[" + Name + "] Info: Fetch asset data for notecard.");
|
||||||
AssetBase asset = m_scene.AssetService.Get(notecardItem.AssetID.ToString());
|
String asset = LoadNotecard(notecardItem.AssetID);
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
m_log.Info("[" + Name + "] Info: Convert notecard to string.");
|
m_log.Info(asset);
|
||||||
String _appearanceNotecard = new ASCIIEncoding().GetString(asset.Data);
|
|
||||||
m_log.Info(_appearanceNotecard);
|
|
||||||
|
|
||||||
m_log.Info("[" + Name + "] Info: Deserialize notecard.");
|
m_log.Info("[" + Name + "] Info: Deserialize notecard.");
|
||||||
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(_appearanceNotecard);
|
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(asset);
|
||||||
AvatarAppearance appearance = new AvatarAppearance();
|
AvatarAppearance appearance = new AvatarAppearance();
|
||||||
appearance.Unpack(appearanceOsd);
|
appearance.Unpack(appearanceOsd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue