aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-09 03:51:34 +0100
committerJustin Clark-Casey (justincc)2011-08-09 03:51:34 +0100
commite869eeb0bfc48c769f680970f99e4c67dd5a1a70 (patch)
tree749440ee4ba12140b708e2fe68e98419710d6ea0 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentfactor out common notecard caching code from 3 methods. (diff)
downloadopensim-SC_OLD-e869eeb0bfc48c769f680970f99e4c67dd5a1a70.zip
opensim-SC_OLD-e869eeb0bfc48c769f680970f99e4c67dd5a1a70.tar.gz
opensim-SC_OLD-e869eeb0bfc48c769f680970f99e4c67dd5a1a70.tar.bz2
opensim-SC_OLD-e869eeb0bfc48c769f680970f99e4c67dd5a1a70.tar.xz
Implement first draft functions for saving and loading NPC appearance from storage.
This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent. By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type. Notecards also allow different appearances to be swapped and manipulated easily. This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text. This works in my basic test but is not at all ready for user use or bug reporting yet.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs33
1 files changed, 27 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7c21ba9..86ee28a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10565,9 +10565,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10565 } 10565 }
10566 } 10566 }
10567 10567
10568 public static string GetLine(UUID assetID, int line, int maxLength) 10568 /// <summary>
10569 /// Get a notecard line.
10570 /// </summary>
10571 /// <param name="assetID"></param>
10572 /// <param name="line">Lines start at index 0</param>
10573 /// <returns></returns>
10574 public static string GetLine(UUID assetID, int lineNumber)
10569 { 10575 {
10570 if (line < 0) 10576 if (lineNumber < 0)
10571 return ""; 10577 return "";
10572 10578
10573 string data; 10579 string data;
@@ -10579,17 +10585,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10579 { 10585 {
10580 m_Notecards[assetID].lastRef = DateTime.Now; 10586 m_Notecards[assetID].lastRef = DateTime.Now;
10581 10587
10582 if (line >= m_Notecards[assetID].text.Length) 10588 if (lineNumber >= m_Notecards[assetID].text.Length)
10583 return "\n\n\n"; 10589 return "\n\n\n";
10584 10590
10585 data = m_Notecards[assetID].text[line]; 10591 data = m_Notecards[assetID].text[lineNumber];
10586 if (data.Length > maxLength)
10587 data = data.Substring(0, maxLength);
10588 10592
10589 return data; 10593 return data;
10590 } 10594 }
10591 } 10595 }
10592 10596
10597 /// <summary>
10598 /// Get a notecard line.
10599 /// </summary>
10600 /// <param name="assetID"></param>
10601 /// <param name="line">Lines start at index 0</param>
10602 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para>
10603 /// <returns></returns>
10604 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
10605 {
10606 string line = GetLine(assetID, lineNumber);
10607
10608 if (line.Length > maxLength)
10609 line = line.Substring(0, maxLength);
10610
10611 return line;
10612 }
10613
10593 public static void CacheCheck() 10614 public static void CacheCheck()
10594 { 10615 {
10595 foreach (UUID key in new List<UUID>(m_Notecards.Keys)) 10616 foreach (UUID key in new List<UUID>(m_Notecards.Keys))