aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs21
-rw-r--r--OpenSim/Framework/DynAttrsOSDMap.cs79
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
4 files changed, 115 insertions, 1 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 29cac3c..b97653b 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -1232,6 +1232,8 @@ namespace OpenSim.Data.SQLite
1232 createCol(prims, "VolumeDetect", typeof(Int16)); 1232 createCol(prims, "VolumeDetect", typeof(Int16));
1233 1233
1234 createCol(prims, "MediaURL", typeof(String)); 1234 createCol(prims, "MediaURL", typeof(String));
1235
1236 createCol(prims, "DynAttrs", typeof(String));
1235 1237
1236 // Add in contraints 1238 // Add in contraints
1237 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 1239 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
@@ -1280,6 +1282,7 @@ namespace OpenSim.Data.SQLite
1280 createCol(shapes, "Texture", typeof(Byte[])); 1282 createCol(shapes, "Texture", typeof(Byte[]));
1281 createCol(shapes, "ExtraParams", typeof(Byte[])); 1283 createCol(shapes, "ExtraParams", typeof(Byte[]));
1282 createCol(shapes, "Media", typeof(String)); 1284 createCol(shapes, "Media", typeof(String));
1285 createCol(shapes, "DynAttrs", typeof(String));
1283 1286
1284 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 1287 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] };
1285 1288
@@ -1711,6 +1714,16 @@ namespace OpenSim.Data.SQLite
1711// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1714// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
1712 prim.MediaUrl = (string)row["MediaURL"]; 1715 prim.MediaUrl = (string)row["MediaURL"];
1713 } 1716 }
1717
1718 if (!(row["DynAttrs"] is System.DBNull))
1719 {
1720 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType());
1721 prim.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]);
1722 }
1723 else
1724 {
1725 prim.DynAttrs = new DynAttrsOSDMap();
1726 }
1714 1727
1715 return prim; 1728 return prim;
1716 } 1729 }
@@ -2133,6 +2146,7 @@ namespace OpenSim.Data.SQLite
2133 row["VolumeDetect"] = 0; 2146 row["VolumeDetect"] = 0;
2134 2147
2135 row["MediaURL"] = prim.MediaUrl; 2148 row["MediaURL"] = prim.MediaUrl;
2149 row["DynAttrs"] = prim.DynAttrs.ToXml();
2136 } 2150 }
2137 2151
2138 /// <summary> 2152 /// <summary>
@@ -2393,6 +2407,11 @@ namespace OpenSim.Data.SQLite
2393 if (!(row["Media"] is System.DBNull)) 2407 if (!(row["Media"] is System.DBNull))
2394 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 2408 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
2395 2409
2410 if (!(row["DynAttrs"] is System.DBNull))
2411 s.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]);
2412 else
2413 s.DynAttrs = new DynAttrsOSDMap();
2414
2396 return s; 2415 return s;
2397 } 2416 }
2398 2417
@@ -2439,6 +2458,8 @@ namespace OpenSim.Data.SQLite
2439 2458
2440 if (s.Media != null) 2459 if (s.Media != null)
2441 row["Media"] = s.Media.ToXml(); 2460 row["Media"] = s.Media.ToXml();
2461
2462 row["DynAttrs"] = s.DynAttrs.ToXml();
2442 } 2463 }
2443 2464
2444 /// <summary> 2465 /// <summary>
diff --git a/OpenSim/Framework/DynAttrsOSDMap.cs b/OpenSim/Framework/DynAttrsOSDMap.cs
new file mode 100644
index 0000000..2d45f66
--- /dev/null
+++ b/OpenSim/Framework/DynAttrsOSDMap.cs
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Text;
32using System.Xml;
33using System.Xml.Schema;
34using System.Xml.Serialization;
35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37
38namespace OpenSim.Framework
39{
40 /// <summary>
41 /// This is the map for storing and retrieving dynamic attributes.
42 /// </summary>
43 public class DynAttrsOSDMap : OSDMap, IXmlSerializable
44 {
45 public XmlSchema GetSchema() { return null; }
46
47 public static DynAttrsOSDMap FromXml(string rawXml)
48 {
49 DynAttrsOSDMap map = new DynAttrsOSDMap();
50 map.ReadXml(rawXml);
51 return map;
52 }
53
54 public void ReadXml(string rawXml)
55 {
56 //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml);
57
58 OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml);
59
60 foreach (string key in map.Keys)
61 this[key] = map[key];
62 }
63
64 public void ReadXml(XmlReader reader)
65 {
66 ReadXml(reader.ReadInnerXml());
67 }
68
69 public string ToXml()
70 {
71 return OSDParser.SerializeLLSDXmlString(this);
72 }
73
74 public void WriteXml(XmlWriter writer)
75 {
76 writer.WriteRaw(ToXml());
77 }
78 }
79} \ No newline at end of file
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 4c36819..fb0255b 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -82,6 +82,11 @@ namespace OpenSim.Framework
82 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 82 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
83 83
84 private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes(); 84 private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes();
85
86 /// <summary>
87 /// Dynamic attributes can be created and deleted as required.
88 /// </summary>
89 public DynAttrsOSDMap DynAttrs { get; set; }
85 90
86 private byte[] m_textureEntry; 91 private byte[] m_textureEntry;
87 92
@@ -194,6 +199,7 @@ namespace OpenSim.Framework
194 { 199 {
195 PCode = (byte)PCodeEnum.Primitive; 200 PCode = (byte)PCodeEnum.Primitive;
196 m_textureEntry = DEFAULT_TEXTURE; 201 m_textureEntry = DEFAULT_TEXTURE;
202 DynAttrs = new DynAttrsOSDMap();
197 } 203 }
198 204
199 /// <summary> 205 /// <summary>
@@ -205,6 +211,7 @@ namespace OpenSim.Framework
205// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID); 211// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID);
206 212
207 PCode = (byte)prim.PrimData.PCode; 213 PCode = (byte)prim.PrimData.PCode;
214 DynAttrs = new DynAttrsOSDMap();
208 215
209 State = prim.PrimData.State; 216 State = prim.PrimData.State;
210 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); 217 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6720635..2a9b99e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -37,6 +37,7 @@ using System.Xml.Serialization;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Scripting; 43using OpenSim.Region.Framework.Scenes.Scripting;
@@ -124,6 +125,11 @@ namespace OpenSim.Region.Framework.Scenes
124 125
125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 126 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 127
128 /// <summary>
129 /// Dynamic attributes can be created and deleted as required.
130 /// </summary>
131 public DynAttrsOSDMap DynAttrs { get; set; }
132
127 /// <value> 133 /// <value>
128 /// Is this a root part? 134 /// Is this a root part?
129 /// </value> 135 /// </value>
@@ -335,6 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
335 m_particleSystem = Utils.EmptyBytes; 341 m_particleSystem = Utils.EmptyBytes;
336 Rezzed = DateTime.UtcNow; 342 Rezzed = DateTime.UtcNow;
337 Description = String.Empty; 343 Description = String.Empty;
344 DynAttrs = new DynAttrsOSDMap();
338 345
339 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 346 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
340 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 347 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -4598,4 +4605,4 @@ namespace OpenSim.Region.Framework.Scenes
4598 } 4605 }
4599 } 4606 }
4600 } 4607 }
4601} \ No newline at end of file 4608}