use notecard reader
parent
093364de5d
commit
478a8218b3
|
@ -71,14 +71,6 @@ namespace OpenSim.Modules.Appearance2Avatar
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string LoadNotecard(SceneObjectPart host, String notecardname)
|
|
||||||
{
|
|
||||||
IScriptEngine wComm = m_scene.RequestModuleInterface<IScriptEngine>();
|
|
||||||
|
|
||||||
IOSSL_Api _api = (IOSSL_Api)wComm.GetApi(host.UUID, "OSSL");
|
|
||||||
return _api.osGetNotecard(notecardname);
|
|
||||||
}
|
|
||||||
|
|
||||||
[ScriptInvocation]
|
[ScriptInvocation]
|
||||||
public void osAppearance2Avatar(UUID hostID, UUID scriptID, String notecard, String targetAvatar)
|
public void osAppearance2Avatar(UUID hostID, UUID scriptID, String notecard, String targetAvatar)
|
||||||
{
|
{
|
||||||
|
@ -94,39 +86,31 @@ namespace OpenSim.Modules.Appearance2Avatar
|
||||||
if (notecardItem != null)
|
if (notecardItem != null)
|
||||||
{
|
{
|
||||||
if (notecardItem.Type != 7)
|
if (notecardItem.Type != 7)
|
||||||
{
|
|
||||||
throw new Exception("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.");
|
m_log.Info("[" + Name + "] Info: Fetch asset data for notecard.");
|
||||||
String asset = LoadNotecard(_host, notecard);
|
NoteCardReader _ncReader = new NoteCardReader(m_scene, _host);
|
||||||
|
String noteCardContend = _ncReader.LoadNotecard(notecard);
|
||||||
|
|
||||||
if (asset != null)
|
if(noteCardContend != null)
|
||||||
{
|
{
|
||||||
m_log.Info(asset);
|
m_log.Info(noteCardContend);
|
||||||
|
|
||||||
m_log.Info("[" + Name + "] Info: Deserialize notecard.");
|
m_log.Info("[" + Name + "] Info: Deserialize notecard.");
|
||||||
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(asset);
|
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(noteCardContend);
|
||||||
AvatarAppearance appearance = new AvatarAppearance();
|
AvatarAppearance appearance = new AvatarAppearance();
|
||||||
appearance.Unpack(appearanceOsd);
|
appearance.Unpack(appearanceOsd);
|
||||||
|
|
||||||
m_log.Info("[" + Name + "] Info: Overwrite appearance");
|
m_log.Info("[" + Name + "] Info: Overwrite appearance");
|
||||||
sp.Appearance = appearance;
|
sp.Appearance = appearance;
|
||||||
sp.TriggerScenePresenceUpdated();
|
|
||||||
|
|
||||||
|
m_log.Info("[" + Name + "] Info: Send update to clients");
|
||||||
|
sp.TriggerScenePresenceUpdated();
|
||||||
m_scene.ForEachClient(
|
m_scene.ForEachClient(
|
||||||
client =>
|
client =>
|
||||||
{
|
{
|
||||||
sp.SendFullUpdateToClient(client);
|
sp.SendFullUpdateToClient(client);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Error("[" + Name + "] ERROR: Cant get asset data for appearance notecard");
|
|
||||||
throw new Exception("Cant get asset data for appearance notecard");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSim.Modules.Appearance2Avatar.helper
|
namespace OpenSim.Modules.Appearance2Avatar.helper
|
||||||
{
|
{
|
||||||
class NotecardCache
|
public class NotecardCache
|
||||||
{
|
{
|
||||||
protected class Notecard
|
protected class Notecard
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue