Allow JsonReadNotecard() to accept the name of the notecard as well as the asset ID.
Agreed in discussion with cmickeyb. This is to make this consistent with similar existing LSL/OSSL functions such as llTriggerSound() and osNpcLoadAppearance() that allow an item name or an asset id.user_profiles
parent
0d4df99d04
commit
eddfed3812
|
@ -39,6 +39,7 @@ using OpenMetaverse.StructuredData;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Scripting;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
@ -256,10 +257,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID)
|
||||
public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); });
|
||||
Util.FireAndForget(o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier));
|
||||
return reqID;
|
||||
}
|
||||
|
||||
|
@ -463,8 +464,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID)
|
||||
private void DoJsonReadNotecard(
|
||||
UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
|
||||
{
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(notecardIdentifier, out assetID))
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
|
||||
assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
|
||||
}
|
||||
|
||||
AssetBase a = m_scene.AssetService.Get(assetID.ToString());
|
||||
if (a == null)
|
||||
GenerateRuntimeError(String.Format("Unable to find notecard asset {0}", assetID));
|
||||
|
@ -486,7 +496,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message);
|
||||
}
|
||||
|
||||
GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString()));
|
||||
GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
|
||||
m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue