diff options
author | Melanie | 2013-06-30 18:27:30 +0100 |
---|---|---|
committer | Melanie | 2013-06-30 18:27:30 +0100 |
commit | ffcee82b1d62150b772464841023a29acc334c84 (patch) | |
tree | 957d562be1f9e567daabb9bfdd25e779ec2c11a4 | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Groups V2: charge for group creation only after the group has been successful... (diff) | |
download | opensim-SC-ffcee82b1d62150b772464841023a29acc334c84.zip opensim-SC-ffcee82b1d62150b772464841023a29acc334c84.tar.gz opensim-SC-ffcee82b1d62150b772464841023a29acc334c84.tar.bz2 opensim-SC-ffcee82b1d62150b772464841023a29acc334c84.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
OpenSim/Region/Framework/Scenes/EventManager.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
26 files changed, 498 insertions, 253 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 7601a50..f621cd3 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -58,7 +58,7 @@ where we are today. | |||
58 | 58 | ||
59 | 59 | ||
60 | = Additional OpenSim Contributors = | 60 | = Additional OpenSim Contributors = |
61 | These folks have contributed code patches to OpenSim to help make it | 61 | These folks have contributed code patches or content to OpenSimulator to help make it |
62 | what it is today. | 62 | what it is today. |
63 | 63 | ||
64 | * aduffy70 | 64 | * aduffy70 |
@@ -163,6 +163,7 @@ what it is today. | |||
163 | * webmage (IBM) | 163 | * webmage (IBM) |
164 | * Xantor | 164 | * Xantor |
165 | * Y. Nitta | 165 | * Y. Nitta |
166 | * YoshikoFazuku | ||
166 | * YZh | 167 | * YZh |
167 | * Zackary Geers aka Kunnis Basiat | 168 | * Zackary Geers aka Kunnis Basiat |
168 | * Zha Ewry | 169 | * Zha Ewry |
@@ -215,5 +216,3 @@ In addition, we would like to thank: | |||
215 | * The Mono Project | 216 | * The Mono Project |
216 | * The NANT Developers | 217 | * The NANT Developers |
217 | * Microsoft (.NET, MSSQL-Adapters) | 218 | * Microsoft (.NET, MSSQL-Adapters) |
218 | *x | ||
219 | |||
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 5b3b9f6..5959bac 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -766,14 +766,17 @@ namespace OpenSim.Groups | |||
766 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); | 766 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); |
767 | return UUID.Zero; | 767 | return UUID.Zero; |
768 | } | 768 | } |
769 | money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | ||
770 | } | 769 | } |
770 | |||
771 | string reason = string.Empty; | 771 | string reason = string.Empty; |
772 | UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, | 772 | UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, |
773 | allowPublish, maturePublish, remoteClient.AgentId, out reason); | 773 | allowPublish, maturePublish, remoteClient.AgentId, out reason); |
774 | 774 | ||
775 | if (groupID != UUID.Zero) | 775 | if (groupID != UUID.Zero) |
776 | { | 776 | { |
777 | if (money != null) | ||
778 | money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | ||
779 | |||
777 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); | 780 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); |
778 | 781 | ||
779 | // Update the founder with new group information. | 782 | // Update the founder with new group information. |
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 00af3a0..bc5beeb 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -2100,7 +2100,7 @@ VALUES | |||
2100 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); | 2100 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); |
2101 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); | 2101 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); |
2102 | 2102 | ||
2103 | if (prim.DynAttrs.Count > 0) | 2103 | if (prim.DynAttrs.CountNamespaces > 0) |
2104 | parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); | 2104 | parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); |
2105 | else | 2105 | else |
2106 | parameters.Add(_Database.CreateParameter("DynAttrs", null)); | 2106 | parameters.Add(_Database.CreateParameter("DynAttrs", null)); |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 537ec85..feacbb2 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -1730,7 +1730,7 @@ namespace OpenSim.Data.MySQL | |||
1730 | else | 1730 | else |
1731 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | 1731 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); |
1732 | 1732 | ||
1733 | if (prim.DynAttrs.Count > 0) | 1733 | if (prim.DynAttrs.CountNamespaces > 0) |
1734 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1734 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1735 | else | 1735 | else |
1736 | cmd.Parameters.AddWithValue("DynAttrs", null); | 1736 | cmd.Parameters.AddWithValue("DynAttrs", null); |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 15ac921..5f1d2ee 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -199,6 +199,8 @@ namespace OpenSim.Data.MySQL | |||
199 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 199 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
200 | public void StoreAsset(AssetBase asset) | 200 | public void StoreAsset(AssetBase asset) |
201 | { | 201 | { |
202 | // m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID); | ||
203 | |||
202 | lock (m_dbLock) | 204 | lock (m_dbLock) |
203 | { | 205 | { |
204 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 206 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index a369b2b..52502b3 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -2176,7 +2176,7 @@ namespace OpenSim.Data.SQLite | |||
2176 | 2176 | ||
2177 | row["MediaURL"] = prim.MediaUrl; | 2177 | row["MediaURL"] = prim.MediaUrl; |
2178 | 2178 | ||
2179 | if (prim.DynAttrs.Count > 0) | 2179 | if (prim.DynAttrs.CountNamespaces > 0) |
2180 | row["DynAttrs"] = prim.DynAttrs.ToXml(); | 2180 | row["DynAttrs"] = prim.DynAttrs.ToXml(); |
2181 | else | 2181 | else |
2182 | row["DynAttrs"] = null; | 2182 | row["DynAttrs"] = null; |
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index df4a6bc..5c729e8 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs | |||
@@ -29,10 +29,12 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | ||
32 | using System.Text; | 33 | using System.Text; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using System.Xml.Schema; | 35 | using System.Xml.Schema; |
35 | using System.Xml.Serialization; | 36 | using System.Xml.Serialization; |
37 | using log4net; | ||
36 | using OpenMetaverse; | 38 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 39 | using OpenMetaverse.StructuredData; |
38 | 40 | ||
@@ -48,13 +50,20 @@ namespace OpenSim.Framework | |||
48 | /// within their data store. However, avoid storing large amounts of data because that | 50 | /// within their data store. However, avoid storing large amounts of data because that |
49 | /// would slow down database access. | 51 | /// would slow down database access. |
50 | /// </remarks> | 52 | /// </remarks> |
51 | public class DAMap : IDictionary<string, OSDMap>, IXmlSerializable | 53 | public class DAMap : IXmlSerializable |
52 | { | 54 | { |
53 | private static readonly int MIN_STORE_NAME_LENGTH = 4; | 55 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 56 | ||
55 | protected OSDMap m_map; | 57 | private static readonly int MIN_NAMESPACE_LENGTH = 4; |
56 | 58 | ||
57 | public DAMap() { m_map = new OSDMap(); } | 59 | private OSDMap m_map = new OSDMap(); |
60 | |||
61 | // WARNING: this is temporary for experimentation only, it will be removed!!!! | ||
62 | public OSDMap TopLevelMap | ||
63 | { | ||
64 | get { return m_map; } | ||
65 | set { m_map = value; } | ||
66 | } | ||
58 | 67 | ||
59 | public XmlSchema GetSchema() { return null; } | 68 | public XmlSchema GetSchema() { return null; } |
60 | 69 | ||
@@ -64,39 +73,34 @@ namespace OpenSim.Framework | |||
64 | map.ReadXml(rawXml); | 73 | map.ReadXml(rawXml); |
65 | return map; | 74 | return map; |
66 | } | 75 | } |
67 | 76 | ||
77 | public void ReadXml(XmlReader reader) | ||
78 | { | ||
79 | ReadXml(reader.ReadInnerXml()); | ||
80 | } | ||
81 | |||
68 | public void ReadXml(string rawXml) | 82 | public void ReadXml(string rawXml) |
69 | { | 83 | { |
70 | // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); | 84 | // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); |
71 | 85 | ||
72 | lock (this) | 86 | lock (this) |
87 | { | ||
73 | m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); | 88 | m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); |
89 | SanitiseMap(this); | ||
90 | } | ||
74 | } | 91 | } |
75 | 92 | ||
76 | // WARNING: this is temporary for experimentation only, it will be removed!!!! | 93 | public void WriteXml(XmlWriter writer) |
77 | public OSDMap TopLevelMap | ||
78 | { | 94 | { |
79 | get { return m_map; } | 95 | writer.WriteRaw(ToXml()); |
80 | set { m_map = value; } | ||
81 | } | 96 | } |
82 | |||
83 | 97 | ||
84 | public void ReadXml(XmlReader reader) | ||
85 | { | ||
86 | ReadXml(reader.ReadInnerXml()); | ||
87 | } | ||
88 | |||
89 | public string ToXml() | 98 | public string ToXml() |
90 | { | 99 | { |
91 | lock (this) | 100 | lock (this) |
92 | return OSDParser.SerializeLLSDXmlString(m_map); | 101 | return OSDParser.SerializeLLSDXmlString(m_map); |
93 | } | 102 | } |
94 | 103 | ||
95 | public void WriteXml(XmlWriter writer) | ||
96 | { | ||
97 | writer.WriteRaw(ToXml()); | ||
98 | } | ||
99 | |||
100 | public void CopyFrom(DAMap other) | 104 | public void CopyFrom(DAMap other) |
101 | { | 105 | { |
102 | // Deep copy | 106 | // Deep copy |
@@ -104,7 +108,7 @@ namespace OpenSim.Framework | |||
104 | string data = null; | 108 | string data = null; |
105 | lock (other) | 109 | lock (other) |
106 | { | 110 | { |
107 | if (other.Count > 0) | 111 | if (other.CountNamespaces > 0) |
108 | { | 112 | { |
109 | data = OSDParser.SerializeLLSDXmlString(other.m_map); | 113 | data = OSDParser.SerializeLLSDXmlString(other.m_map); |
110 | } | 114 | } |
@@ -120,59 +124,136 @@ namespace OpenSim.Framework | |||
120 | } | 124 | } |
121 | 125 | ||
122 | /// <summary> | 126 | /// <summary> |
123 | /// Returns the number of data stores. | 127 | /// Sanitise the map to remove any namespaces or stores that are not OSDMap. |
124 | /// </summary> | 128 | /// </summary> |
125 | public int Count { get { lock (this) { return m_map.Count; } } } | 129 | /// <param name='map'> |
126 | 130 | /// </param> | |
127 | public bool IsReadOnly { get { return false; } } | 131 | public static void SanitiseMap(DAMap daMap) |
128 | 132 | { | |
133 | List<string> keysToRemove = null; | ||
134 | |||
135 | // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should | ||
136 | // handle reading data from old locations | ||
137 | bool osMaterialsMigrationRequired = false; | ||
138 | |||
139 | OSDMap namespacesMap = daMap.m_map; | ||
140 | |||
141 | foreach (string key in namespacesMap.Keys) | ||
142 | { | ||
143 | // Console.WriteLine("Processing ns {0}", key); | ||
144 | if (!(namespacesMap[key] is OSDMap)) | ||
145 | { | ||
146 | if (keysToRemove == null) | ||
147 | keysToRemove = new List<string>(); | ||
148 | |||
149 | keysToRemove.Add(key); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | if (keysToRemove != null) | ||
154 | { | ||
155 | foreach (string key in keysToRemove) | ||
156 | { | ||
157 | // Console.WriteLine ("Removing bad ns {0}", key); | ||
158 | namespacesMap.Remove(key); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | foreach (OSD nsOsd in namespacesMap.Values) | ||
163 | { | ||
164 | OSDMap nsOsdMap = (OSDMap)nsOsd; | ||
165 | keysToRemove = null; | ||
166 | |||
167 | foreach (string key in nsOsdMap.Keys) | ||
168 | { | ||
169 | if (!(nsOsdMap[key] is OSDMap)) | ||
170 | { | ||
171 | if (keysToRemove == null) | ||
172 | keysToRemove = new List<string>(); | ||
173 | |||
174 | keysToRemove.Add(key); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | if (keysToRemove != null) | ||
179 | foreach (string key in keysToRemove) | ||
180 | nsOsdMap.Remove(key); | ||
181 | } | ||
182 | } | ||
183 | |||
129 | /// <summary> | 184 | /// <summary> |
130 | /// Returns the names of the data stores. | 185 | /// Get the number of namespaces |
131 | /// </summary> | 186 | /// </summary> |
132 | public ICollection<string> Keys { get { lock (this) { return m_map.Keys; } } } | 187 | public int CountNamespaces { get { lock (this) { return m_map.Count; } } } |
133 | 188 | ||
134 | /// <summary> | 189 | /// <summary> |
135 | /// Returns all the data stores. | 190 | /// Get the number of stores. |
136 | /// </summary> | 191 | /// </summary> |
137 | public ICollection<OSDMap> Values | 192 | public int CountStores |
138 | { | 193 | { |
139 | get | 194 | get |
140 | { | 195 | { |
196 | int count = 0; | ||
197 | |||
141 | lock (this) | 198 | lock (this) |
142 | { | 199 | { |
143 | List<OSDMap> stores = new List<OSDMap>(m_map.Count); | 200 | foreach (OSD osdNamespace in m_map) |
144 | foreach (OSD llsd in m_map.Values) | 201 | { |
145 | stores.Add((OSDMap)llsd); | 202 | count += ((OSDMap)osdNamespace).Count; |
146 | return stores; | 203 | } |
147 | } | 204 | } |
205 | |||
206 | return count; | ||
148 | } | 207 | } |
149 | } | 208 | } |
150 | 209 | ||
151 | /// <summary> | 210 | /// <summary> |
152 | /// Gets or sets one data store. | 211 | /// Retrieve a Dynamic Attribute store |
153 | /// </summary> | 212 | /// </summary> |
154 | /// <param name="key">Store name</param> | 213 | /// <param name="ns">namespace for the store - use "OpenSim" for in-core modules</param> |
155 | /// <returns></returns> | 214 | /// <param name="storeName">name of the store within the namespace</param> |
156 | public OSDMap this[string key] | 215 | /// <returns>an OSDMap representing the stored data, or null if not found</returns> |
157 | { | 216 | public OSDMap GetStore(string ns, string storeName) |
158 | get | 217 | { |
159 | { | 218 | OSD namespaceOsd; |
160 | OSD llsd; | 219 | |
161 | 220 | lock (this) | |
162 | lock (this) | 221 | { |
222 | if (m_map.TryGetValue(ns, out namespaceOsd)) | ||
163 | { | 223 | { |
164 | if (m_map.TryGetValue(key, out llsd)) | 224 | OSD store; |
165 | return (OSDMap)llsd; | 225 | |
166 | else | 226 | if (((OSDMap)namespaceOsd).TryGetValue(storeName, out store)) |
167 | return null; | 227 | return (OSDMap)store; |
168 | } | 228 | } |
169 | } | 229 | } |
170 | 230 | ||
171 | set | 231 | return null; |
232 | } | ||
233 | |||
234 | /// <summary> | ||
235 | /// Saves a Dynamic attribute store | ||
236 | /// </summary> | ||
237 | /// <param name="ns">namespace for the store - use "OpenSim" for in-core modules</param> | ||
238 | /// <param name="storeName">name of the store within the namespace</param> | ||
239 | /// <param name="store">an OSDMap representing the data to store</param> | ||
240 | public void SetStore(string ns, string storeName, OSDMap store) | ||
241 | { | ||
242 | ValidateNamespace(ns); | ||
243 | OSDMap nsMap; | ||
244 | |||
245 | lock (this) | ||
172 | { | 246 | { |
173 | ValidateKey(key); | 247 | if (!m_map.ContainsKey(ns)) |
174 | lock (this) | 248 | { |
175 | m_map[key] = value; | 249 | nsMap = new OSDMap(); |
250 | m_map[ns] = nsMap; | ||
251 | } | ||
252 | |||
253 | nsMap = (OSDMap)m_map[ns]; | ||
254 | |||
255 | // m_log.DebugFormat("[DA MAP]: Setting store to {0}:{1}", ns, storeName); | ||
256 | nsMap[storeName] = store; | ||
176 | } | 257 | } |
177 | } | 258 | } |
178 | 259 | ||
@@ -180,54 +261,46 @@ namespace OpenSim.Framework | |||
180 | /// Validate the key used for storing separate data stores. | 261 | /// Validate the key used for storing separate data stores. |
181 | /// </summary> | 262 | /// </summary> |
182 | /// <param name='key'></param> | 263 | /// <param name='key'></param> |
183 | public static void ValidateKey(string key) | 264 | public static void ValidateNamespace(string ns) |
184 | { | 265 | { |
185 | if (key.Length < MIN_STORE_NAME_LENGTH) | 266 | if (ns.Length < MIN_NAMESPACE_LENGTH) |
186 | throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH); | 267 | throw new Exception("Minimum namespace length is " + MIN_NAMESPACE_LENGTH); |
187 | } | 268 | } |
188 | 269 | ||
189 | public bool ContainsKey(string key) | 270 | public bool ContainsStore(string ns, string storeName) |
190 | { | 271 | { |
191 | lock (this) | 272 | OSD namespaceOsd; |
192 | return m_map.ContainsKey(key); | ||
193 | } | ||
194 | 273 | ||
195 | public void Add(string key, OSDMap store) | ||
196 | { | ||
197 | ValidateKey(key); | ||
198 | lock (this) | ||
199 | m_map.Add(key, store); | ||
200 | } | ||
201 | |||
202 | public void Add(KeyValuePair<string, OSDMap> kvp) | ||
203 | { | ||
204 | ValidateKey(kvp.Key); | ||
205 | lock (this) | 274 | lock (this) |
206 | m_map.Add(kvp.Key, kvp.Value); | 275 | { |
207 | } | 276 | if (m_map.TryGetValue(ns, out namespaceOsd)) |
277 | { | ||
278 | return ((OSDMap)namespaceOsd).ContainsKey(storeName); | ||
279 | } | ||
280 | } | ||
208 | 281 | ||
209 | public bool Remove(string key) | 282 | return false; |
210 | { | 283 | } |
211 | lock (this) | ||
212 | return m_map.Remove(key); | ||
213 | } | ||
214 | 284 | ||
215 | public bool TryGetValue(string key, out OSDMap store) | 285 | public bool TryGetStore(string ns, string storeName, out OSDMap store) |
216 | { | 286 | { |
287 | OSD namespaceOsd; | ||
288 | |||
217 | lock (this) | 289 | lock (this) |
218 | { | 290 | { |
219 | OSD llsd; | 291 | if (m_map.TryGetValue(ns, out namespaceOsd)) |
220 | if (m_map.TryGetValue(key, out llsd)) | ||
221 | { | ||
222 | store = (OSDMap)llsd; | ||
223 | return true; | ||
224 | } | ||
225 | else | ||
226 | { | 292 | { |
227 | store = null; | 293 | OSD storeOsd; |
228 | return false; | 294 | |
295 | bool result = ((OSDMap)namespaceOsd).TryGetValue(storeName, out storeOsd); | ||
296 | store = (OSDMap)storeOsd; | ||
297 | |||
298 | return result; | ||
229 | } | 299 | } |
230 | } | 300 | } |
301 | |||
302 | store = null; | ||
303 | return false; | ||
231 | } | 304 | } |
232 | 305 | ||
233 | public void Clear() | 306 | public void Clear() |
@@ -235,39 +308,25 @@ namespace OpenSim.Framework | |||
235 | lock (this) | 308 | lock (this) |
236 | m_map.Clear(); | 309 | m_map.Clear(); |
237 | } | 310 | } |
238 | |||
239 | public bool Contains(KeyValuePair<string, OSDMap> kvp) | ||
240 | { | ||
241 | lock (this) | ||
242 | return m_map.ContainsKey(kvp.Key); | ||
243 | } | ||
244 | |||
245 | public void CopyTo(KeyValuePair<string, OSDMap>[] array, int index) | ||
246 | { | ||
247 | throw new NotImplementedException(); | ||
248 | } | ||
249 | 311 | ||
250 | public bool Remove(KeyValuePair<string, OSDMap> kvp) | 312 | public bool RemoveStore(string ns, string storeName) |
251 | { | 313 | { |
252 | lock (this) | 314 | OSD namespaceOsd; |
253 | return m_map.Remove(kvp.Key); | ||
254 | } | ||
255 | 315 | ||
256 | public System.Collections.IDictionaryEnumerator GetEnumerator() | ||
257 | { | ||
258 | lock (this) | 316 | lock (this) |
259 | return m_map.GetEnumerator(); | 317 | { |
260 | } | 318 | if (m_map.TryGetValue(ns, out namespaceOsd)) |
319 | { | ||
320 | OSDMap namespaceOsdMap = (OSDMap)namespaceOsd; | ||
321 | namespaceOsdMap.Remove(storeName); | ||
261 | 322 | ||
262 | IEnumerator<KeyValuePair<string, OSDMap>> IEnumerable<KeyValuePair<string, OSDMap>>.GetEnumerator() | 323 | // Don't keep empty namespaces around |
263 | { | 324 | if (namespaceOsdMap.Count <= 0) |
264 | return null; | 325 | m_map.Remove(ns); |
265 | } | 326 | } |
327 | } | ||
266 | 328 | ||
267 | IEnumerator IEnumerable.GetEnumerator() | 329 | return false; |
268 | { | 330 | } |
269 | lock (this) | ||
270 | return m_map.GetEnumerator(); | ||
271 | } | ||
272 | } | 331 | } |
273 | } \ No newline at end of file | 332 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/DOMap.cs b/OpenSim/Framework/DOMap.cs index 755e129..f5b650b 100644 --- a/OpenSim/Framework/DOMap.cs +++ b/OpenSim/Framework/DOMap.cs | |||
@@ -42,22 +42,22 @@ namespace OpenSim.Framework | |||
42 | /// This class stores and retrieves dynamic objects. | 42 | /// This class stores and retrieves dynamic objects. |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <remarks> | 44 | /// <remarks> |
45 | /// Experimental - DO NOT USE. | 45 | /// Experimental - DO NOT USE. Does not yet have namespace support. |
46 | /// </remarks> | 46 | /// </remarks> |
47 | public class DOMap | 47 | public class DOMap |
48 | { | 48 | { |
49 | private IDictionary<string, object> m_map; | 49 | private IDictionary<string, object> m_map; |
50 | 50 | ||
51 | public void Add(string key, object dynObj) | 51 | public void Add(string ns, string objName, object dynObj) |
52 | { | 52 | { |
53 | DAMap.ValidateKey(key); | 53 | DAMap.ValidateNamespace(ns); |
54 | 54 | ||
55 | lock (this) | 55 | lock (this) |
56 | { | 56 | { |
57 | if (m_map == null) | 57 | if (m_map == null) |
58 | m_map = new Dictionary<string, object>(); | 58 | m_map = new Dictionary<string, object>(); |
59 | 59 | ||
60 | m_map.Add(key, dynObj); | 60 | m_map.Add(objName, dynObj); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 312e9a9..dfa37ca 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -972,11 +972,12 @@ namespace OpenSim.Framework | |||
972 | /// <param name="verb"></param> | 972 | /// <param name="verb"></param> |
973 | /// <param name="requestUrl"></param> | 973 | /// <param name="requestUrl"></param> |
974 | /// <param name="obj"> </param> | 974 | /// <param name="obj"> </param> |
975 | /// <param name="timeoutsecs"> </param> | ||
975 | /// <returns></returns> | 976 | /// <returns></returns> |
976 | /// | 977 | /// |
977 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | 978 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting |
978 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 979 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
979 | public static string MakeRequest(string verb, string requestUrl, string obj) | 980 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) |
980 | { | 981 | { |
981 | int reqnum = WebUtil.RequestNumber++; | 982 | int reqnum = WebUtil.RequestNumber++; |
982 | 983 | ||
@@ -990,6 +991,8 @@ namespace OpenSim.Framework | |||
990 | 991 | ||
991 | WebRequest request = WebRequest.Create(requestUrl); | 992 | WebRequest request = WebRequest.Create(requestUrl); |
992 | request.Method = verb; | 993 | request.Method = verb; |
994 | if (timeoutsecs > 0) | ||
995 | request.Timeout = timeoutsecs * 1000; | ||
993 | string respstring = String.Empty; | 996 | string respstring = String.Empty; |
994 | 997 | ||
995 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | 998 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); |
@@ -1086,6 +1089,11 @@ namespace OpenSim.Framework | |||
1086 | 1089 | ||
1087 | return respstring; | 1090 | return respstring; |
1088 | } | 1091 | } |
1092 | |||
1093 | public static string MakeRequest(string verb, string requestUrl, string obj) | ||
1094 | { | ||
1095 | return MakeRequest(verb, requestUrl, obj, -1); | ||
1096 | } | ||
1089 | } | 1097 | } |
1090 | 1098 | ||
1091 | public class SynchronousRestObjectRequester | 1099 | public class SynchronousRestObjectRequester |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index b3e3aa2..ae45b99 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -183,6 +183,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
183 | if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) | 183 | if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) |
184 | { | 184 | { |
185 | IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); | 185 | IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); |
186 | m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend); | ||
186 | uMan.AddUser(id, url + ";" + first + " " + last); | 187 | uMan.AddUser(id, url + ";" + first + " " + last); |
187 | } | 188 | } |
188 | } | 189 | } |
@@ -347,31 +348,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
347 | return null; | 348 | return null; |
348 | } | 349 | } |
349 | 350 | ||
350 | public override FriendInfo[] GetFriendsFromService(IClientAPI client) | 351 | // public override FriendInfo[] GetFriendsFromService(IClientAPI client) |
351 | { | 352 | // { |
352 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); | 353 | //// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); |
353 | Boolean agentIsLocal = true; | 354 | // Boolean agentIsLocal = true; |
354 | if (UserManagementModule != null) | 355 | // if (UserManagementModule != null) |
355 | agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); | 356 | // agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); |
356 | 357 | ||
357 | if (agentIsLocal) | 358 | // if (agentIsLocal) |
358 | return base.GetFriendsFromService(client); | 359 | // return base.GetFriendsFromService(client); |
359 | 360 | ||
360 | FriendInfo[] finfos = new FriendInfo[0]; | 361 | // FriendInfo[] finfos = new FriendInfo[0]; |
361 | // Foreigner | 362 | // // Foreigner |
362 | AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | 363 | // AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); |
363 | if (agentClientCircuit != null) | 364 | // if (agentClientCircuit != null) |
364 | { | 365 | // { |
365 | //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); | 366 | // //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); |
366 | 367 | ||
367 | finfos = FriendsService.GetFriends(client.AgentId.ToString()); | 368 | // finfos = FriendsService.GetFriends(client.AgentId.ToString()); |
368 | m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); | 369 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); |
369 | } | 370 | // } |
370 | 371 | ||
371 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); | 372 | //// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); |
372 | 373 | ||
373 | return finfos; | 374 | // return finfos; |
374 | } | 375 | // } |
375 | 376 | ||
376 | protected override bool StoreRights(UUID agentID, UUID friendID, int rights) | 377 | protected override bool StoreRights(UUID agentID, UUID friendID, int rights) |
377 | { | 378 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs index 1f1568f..0c632b1 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs | |||
@@ -44,11 +44,12 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule | |||
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] |
45 | public class DAExampleModule : INonSharedRegionModule | 45 | public class DAExampleModule : INonSharedRegionModule |
46 | { | 46 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private static readonly bool ENABLED = false; // enable for testing | 49 | private readonly bool ENABLED = false; // enable for testing |
50 | 50 | ||
51 | public const string DANamespace = "DAExample Module"; | 51 | public const string Namespace = "Example"; |
52 | public const string StoreName = "DA"; | ||
52 | 53 | ||
53 | protected Scene m_scene; | 54 | protected Scene m_scene; |
54 | protected IDialogModule m_dialogMod; | 55 | protected IDialogModule m_dialogMod; |
@@ -65,6 +66,8 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule | |||
65 | m_scene = scene; | 66 | m_scene = scene; |
66 | m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove; | 67 | m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove; |
67 | m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>(); | 68 | m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>(); |
69 | |||
70 | m_log.DebugFormat("[DA EXAMPLE MODULE]: Added region {0}", m_scene.Name); | ||
68 | } | 71 | } |
69 | } | 72 | } |
70 | 73 | ||
@@ -91,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule | |||
91 | if (sop == null) | 94 | if (sop == null) |
92 | return true; | 95 | return true; |
93 | 96 | ||
94 | if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs)) | 97 | if (!sop.DynAttrs.TryGetStore(Namespace, StoreName, out attrs)) |
95 | attrs = new OSDMap(); | 98 | attrs = new OSDMap(); |
96 | 99 | ||
97 | OSDInteger newValue; | 100 | OSDInteger newValue; |
@@ -106,12 +109,14 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule | |||
106 | 109 | ||
107 | attrs["moves"] = newValue; | 110 | attrs["moves"] = newValue; |
108 | 111 | ||
109 | sop.DynAttrs[DANamespace] = attrs; | 112 | sop.DynAttrs.SetStore(Namespace, StoreName, attrs); |
110 | } | 113 | } |
111 | 114 | ||
112 | sop.ParentGroup.HasGroupChanged = true; | 115 | sop.ParentGroup.HasGroupChanged = true; |
113 | 116 | ||
114 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); | 117 | string msg = string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue); |
118 | m_log.DebugFormat("[DA EXAMPLE MODULE]: {0}", msg); | ||
119 | m_dialogMod.SendGeneralAlert(msg); | ||
115 | 120 | ||
116 | return true; | 121 | return true; |
117 | } | 122 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs index 650aa35..166a994 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs | |||
@@ -64,8 +64,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | |||
64 | 64 | ||
65 | private Scene m_scene; | 65 | private Scene m_scene; |
66 | private IDialogModule m_dialogMod; | 66 | private IDialogModule m_dialogMod; |
67 | 67 | ||
68 | public string Name { get { return "DOExample Module"; } } | 68 | public string Name { get { return "DO"; } } |
69 | public Type ReplaceableInterface { get { return null; } } | 69 | public Type ReplaceableInterface { get { return null; } } |
70 | 70 | ||
71 | public void Initialise(IConfigSource source) {} | 71 | public void Initialise(IConfigSource source) {} |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | |||
106 | 106 | ||
107 | // Console.WriteLine("Here for {0}", so.Name); | 107 | // Console.WriteLine("Here for {0}", so.Name); |
108 | 108 | ||
109 | if (rootPart.DynAttrs.TryGetValue(DAExampleModule.DANamespace, out attrs)) | 109 | if (rootPart.DynAttrs.TryGetStore(DAExampleModule.Namespace, DAExampleModule.StoreName, out attrs)) |
110 | { | 110 | { |
111 | movesSoFar = attrs["moves"].AsInteger(); | 111 | movesSoFar = attrs["moves"].AsInteger(); |
112 | 112 | ||
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | |||
114 | "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name); | 114 | "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name); |
115 | } | 115 | } |
116 | 116 | ||
117 | rootPart.DynObjs.Add(Name, new MyObject(movesSoFar)); | 117 | rootPart.DynObjs.Add(DAExampleModule.Namespace, Name, new MyObject(movesSoFar)); |
118 | } | 118 | } |
119 | 119 | ||
120 | private bool OnSceneGroupMove(UUID groupId, Vector3 delta) | 120 | private bool OnSceneGroupMove(UUID groupId, Vector3 delta) |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 864e181..194b591 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -320,7 +320,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
320 | else | 320 | else |
321 | { | 321 | { |
322 | names[0] = "Unknown"; | 322 | names[0] = "Unknown"; |
323 | names[1] = "UserUMMTGUN2"; | 323 | names[1] = "UserUMMTGUN3"; |
324 | 324 | ||
325 | return false; | 325 | return false; |
326 | } | 326 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index ec5751d..99913a9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -196,7 +196,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
196 | Util.FireAndForget(delegate | 196 | Util.FireAndForget(delegate |
197 | { | 197 | { |
198 | foreach (InventoryItemBase item in items) | 198 | foreach (InventoryItemBase item in items) |
199 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 199 | if (!string.IsNullOrEmpty(item.CreatorData)) |
200 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | ||
200 | }); | 201 | }); |
201 | } | 202 | } |
202 | 203 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 2d3ba82..70ba944 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -204,7 +204,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
204 | Util.FireAndForget(delegate | 204 | Util.FireAndForget(delegate |
205 | { | 205 | { |
206 | foreach (InventoryItemBase item in items) | 206 | foreach (InventoryItemBase item in items) |
207 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 207 | if (!string.IsNullOrEmpty(item.CreatorData)) |
208 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | ||
208 | }); | 209 | }); |
209 | } | 210 | } |
210 | 211 | ||
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index b4348c9..66059fb 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -144,7 +144,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
144 | <Flags>None</Flags> | 144 | <Flags>None</Flags> |
145 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> | 145 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> |
146 | <CollisionSoundVolume>0</CollisionSoundVolume> | 146 | <CollisionSoundVolume>0</CollisionSoundVolume> |
147 | <DynAttrs><llsd><map><key>MyStore</key><map><key>the answer</key><integer>42</integer></map></map></llsd></DynAttrs> | 147 | <DynAttrs> |
148 | <llsd> | ||
149 | <map> | ||
150 | <key>MyNamespace</key> | ||
151 | <map> | ||
152 | <key>MyStore</key> | ||
153 | <map> | ||
154 | <key>the answer</key> | ||
155 | <integer>42</integer> | ||
156 | </map> | ||
157 | </map> | ||
158 | </map> | ||
159 | </llsd> | ||
160 | </DynAttrs> | ||
148 | </SceneObjectPart> | 161 | </SceneObjectPart> |
149 | </RootPart> | 162 | </RootPart> |
150 | <OtherParts /> | 163 | <OtherParts /> |
@@ -333,7 +346,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
333 | <EveryoneMask>0</EveryoneMask> | 346 | <EveryoneMask>0</EveryoneMask> |
334 | <NextOwnerMask>2147483647</NextOwnerMask> | 347 | <NextOwnerMask>2147483647</NextOwnerMask> |
335 | <Flags>None</Flags> | 348 | <Flags>None</Flags> |
336 | <DynAttrs><llsd><map><key>MyStore</key><map><key>last words</key><string>Rosebud</string></map></map></llsd></DynAttrs> | 349 | <DynAttrs> |
350 | <llsd> | ||
351 | <map> | ||
352 | <key>MyNamespace</key> | ||
353 | <map> | ||
354 | <key>MyStore</key> | ||
355 | <map> | ||
356 | <key>last words</key> | ||
357 | <string>Rosebud</string> | ||
358 | </map> | ||
359 | </map> | ||
360 | </map> | ||
361 | </llsd> | ||
362 | </DynAttrs> | ||
337 | <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar> | 363 | <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar> |
338 | </SceneObjectPart> | 364 | </SceneObjectPart> |
339 | <OtherParts /> | 365 | <OtherParts /> |
@@ -362,7 +388,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
362 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); | 388 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); |
363 | Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); | 389 | Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); |
364 | Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); | 390 | Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); |
365 | OSDMap store = rootPart.DynAttrs["MyStore"]; | 391 | OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore"); |
366 | Assert.AreEqual(42, store["the answer"].AsInteger()); | 392 | Assert.AreEqual(42, store["the answer"].AsInteger()); |
367 | 393 | ||
368 | // TODO: Check other properties | 394 | // TODO: Check other properties |
@@ -414,13 +440,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
414 | rp.CreatorID = rpCreatorId; | 440 | rp.CreatorID = rpCreatorId; |
415 | rp.Shape = shape; | 441 | rp.Shape = shape; |
416 | 442 | ||
443 | string daNamespace = "MyNamespace"; | ||
417 | string daStoreName = "MyStore"; | 444 | string daStoreName = "MyStore"; |
418 | string daKey = "foo"; | 445 | string daKey = "foo"; |
419 | string daValue = "bar"; | 446 | string daValue = "bar"; |
420 | OSDMap myStore = new OSDMap(); | 447 | OSDMap myStore = new OSDMap(); |
421 | myStore.Add(daKey, daValue); | 448 | myStore.Add(daKey, daValue); |
422 | rp.DynAttrs = new DAMap(); | 449 | rp.DynAttrs = new DAMap(); |
423 | rp.DynAttrs[daStoreName] = myStore; | 450 | rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore); |
424 | 451 | ||
425 | SceneObjectGroup so = new SceneObjectGroup(rp); | 452 | SceneObjectGroup so = new SceneObjectGroup(rp); |
426 | 453 | ||
@@ -481,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
481 | Assert.That(name, Is.EqualTo(rpName)); | 508 | Assert.That(name, Is.EqualTo(rpName)); |
482 | Assert.That(creatorId, Is.EqualTo(rpCreatorId)); | 509 | Assert.That(creatorId, Is.EqualTo(rpCreatorId)); |
483 | Assert.NotNull(daMap); | 510 | Assert.NotNull(daMap); |
484 | Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); | 511 | Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString()); |
485 | } | 512 | } |
486 | 513 | ||
487 | [Test] | 514 | [Test] |
@@ -496,7 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
496 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); | 523 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); |
497 | Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); | 524 | Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); |
498 | Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); | 525 | Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); |
499 | OSDMap store = rootPart.DynAttrs["MyStore"]; | 526 | OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore"); |
500 | Assert.AreEqual("Rosebud", store["last words"].AsString()); | 527 | Assert.AreEqual("Rosebud", store["last words"].AsString()); |
501 | 528 | ||
502 | // TODO: Check other properties | 529 | // TODO: Check other properties |
@@ -522,13 +549,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
522 | rp.CreatorID = rpCreatorId; | 549 | rp.CreatorID = rpCreatorId; |
523 | rp.Shape = shape; | 550 | rp.Shape = shape; |
524 | 551 | ||
552 | string daNamespace = "MyNamespace"; | ||
525 | string daStoreName = "MyStore"; | 553 | string daStoreName = "MyStore"; |
526 | string daKey = "foo"; | 554 | string daKey = "foo"; |
527 | string daValue = "bar"; | 555 | string daValue = "bar"; |
528 | OSDMap myStore = new OSDMap(); | 556 | OSDMap myStore = new OSDMap(); |
529 | myStore.Add(daKey, daValue); | 557 | myStore.Add(daKey, daValue); |
530 | rp.DynAttrs = new DAMap(); | 558 | rp.DynAttrs = new DAMap(); |
531 | rp.DynAttrs[daStoreName] = myStore; | 559 | rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore); |
532 | 560 | ||
533 | SceneObjectGroup so = new SceneObjectGroup(rp); | 561 | SceneObjectGroup so = new SceneObjectGroup(rp); |
534 | 562 | ||
@@ -585,7 +613,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
585 | Assert.That(name, Is.EqualTo(rpName)); | 613 | Assert.That(name, Is.EqualTo(rpName)); |
586 | Assert.That(creatorId, Is.EqualTo(rpCreatorId)); | 614 | Assert.That(creatorId, Is.EqualTo(rpCreatorId)); |
587 | Assert.NotNull(daMap); | 615 | Assert.NotNull(daMap); |
588 | Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); | 616 | Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString()); |
589 | } | 617 | } |
590 | } | 618 | } |
591 | } \ No newline at end of file | 619 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4fec44f..1018b54 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -1026,6 +1026,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1026 | /// </remarks> | 1026 | /// </remarks> |
1027 | public event TeleportFail OnTeleportFail; | 1027 | public event TeleportFail OnTeleportFail; |
1028 | 1028 | ||
1029 | // public delegate void GatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids); | ||
1030 | // | ||
1031 | // /// <summary> | ||
1032 | // /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc. | ||
1033 | // /// </summary> | ||
1034 | // /// <remarks> | ||
1035 | // /// The listener should add references to the IDictionary<UUID, AssetType> as appropriate. | ||
1036 | // /// </remarks> | ||
1037 | // public event GatherUuids OnGatherUuids; | ||
1038 | |||
1029 | public class MoneyTransferArgs : EventArgs | 1039 | public class MoneyTransferArgs : EventArgs |
1030 | { | 1040 | { |
1031 | public UUID sender; | 1041 | public UUID sender; |
@@ -3274,5 +3284,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3274 | handler(scenePresence); | 3284 | handler(scenePresence); |
3275 | } | 3285 | } |
3276 | } | 3286 | } |
3287 | |||
3288 | // public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids) | ||
3289 | // { | ||
3290 | // GatherUuids handler = OnGatherUuids; | ||
3291 | // | ||
3292 | // if (handler != null) | ||
3293 | // { | ||
3294 | // foreach (GatherUuids d in handler.GetInvocationList()) | ||
3295 | // { | ||
3296 | // try | ||
3297 | // { | ||
3298 | // d(sop, assetUuids); | ||
3299 | // } | ||
3300 | // catch (Exception e) | ||
3301 | // { | ||
3302 | // m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", | ||
3303 | // e.Message, e.StackTrace); | ||
3304 | // } | ||
3305 | // } | ||
3306 | // } | ||
3307 | // } | ||
3277 | } | 3308 | } |
3278 | } | 3309 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0a18d8a..9e3d875 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3810,20 +3810,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3810 | /// <summary> | 3810 | /// <summary> |
3811 | /// Update just the root prim position in a linkset | 3811 | /// Update just the root prim position in a linkset |
3812 | /// </summary> | 3812 | /// </summary> |
3813 | /// <param name="pos"></param> | 3813 | /// <param name="newPos"></param> |
3814 | public void UpdateRootPosition(Vector3 pos) | 3814 | public void UpdateRootPosition(Vector3 newPos) |
3815 | { | 3815 | { |
3816 | // needs to be called with phys building true | 3816 | // needs to be called with phys building true |
3817 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 3817 | Vector3 oldPos; |
3818 | Vector3 oldPos = | 3818 | |
3819 | new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, | 3819 | // FIXME: This improves the situation where editing just the root prim of an attached object would send |
3820 | AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, | 3820 | // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim |
3821 | AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); | 3821 | // still ends up in the wrong position on reattach. |
3822 | if (IsAttachment) | ||
3823 | oldPos = RootPart.OffsetPosition; | ||
3824 | else | ||
3825 | oldPos = AbsolutePosition + RootPart.OffsetPosition; | ||
3826 | |||
3822 | Vector3 diff = oldPos - newPos; | 3827 | Vector3 diff = oldPos - newPos; |
3823 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | ||
3824 | Quaternion partRotation = m_rootPart.RotationOffset; | 3828 | Quaternion partRotation = m_rootPart.RotationOffset; |
3825 | axDiff *= Quaternion.Inverse(partRotation); | 3829 | diff *= Quaternion.Inverse(partRotation); |
3826 | diff = axDiff; | ||
3827 | 3830 | ||
3828 | SceneObjectPart[] parts = m_parts.GetArray(); | 3831 | SceneObjectPart[] parts = m_parts.GetArray(); |
3829 | for (int i = 0; i < parts.Length; i++) | 3832 | for (int i = 0; i < parts.Length; i++) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index ce4fb40..68918d3 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -1346,7 +1346,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1346 | if (sop.MediaUrl != null) | 1346 | if (sop.MediaUrl != null) |
1347 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1347 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1348 | 1348 | ||
1349 | if (sop.DynAttrs.Count > 0) | 1349 | if (sop.DynAttrs.CountNamespaces > 0) |
1350 | { | 1350 | { |
1351 | writer.WriteStartElement("DynAttrs"); | 1351 | writer.WriteStartElement("DynAttrs"); |
1352 | sop.DynAttrs.WriteXml(writer); | 1352 | sop.DynAttrs.WriteXml(writer); |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 7b47275..e60a025 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -182,7 +182,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
182 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); | 182 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); |
183 | } | 183 | } |
184 | 184 | ||
185 | // get any texture UUIDs used for materials such as normal and specular maps | 185 | // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed |
186 | // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and | ||
187 | // inventory transfer. There needs to be a way for a module to register a method without assuming a | ||
188 | // Scene.EventManager is present. | ||
189 | // part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); | ||
190 | |||
186 | GatherMaterialsUuids(part, assetUuids); | 191 | GatherMaterialsUuids(part, assetUuids); |
187 | } | 192 | } |
188 | catch (Exception e) | 193 | catch (Exception e) |
@@ -208,7 +213,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | // } | 213 | // } |
209 | // } | 214 | // } |
210 | 215 | ||
211 | |||
212 | /// <summary> | 216 | /// <summary> |
213 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps | 217 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps |
214 | /// </summary> | 218 | /// </summary> |
@@ -217,20 +221,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) | 221 | public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) |
218 | { | 222 | { |
219 | // scan thru the dynAttrs map of this part for any textures used as materials | 223 | // scan thru the dynAttrs map of this part for any textures used as materials |
220 | OSDMap OSMaterials = null; | 224 | OSD osdMaterials = null; |
221 | 225 | ||
222 | lock (part.DynAttrs) | 226 | lock (part.DynAttrs) |
223 | { | 227 | { |
224 | if (part.DynAttrs.ContainsKey("OS:Materials")) | 228 | if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) |
225 | OSMaterials = part.DynAttrs["OS:Materials"]; | 229 | { |
226 | if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) | 230 | OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); |
231 | |||
232 | if (materialsStore == null) | ||
233 | return; | ||
234 | |||
235 | materialsStore.TryGetValue("Materials", out osdMaterials); | ||
236 | } | ||
237 | |||
238 | if (osdMaterials != null) | ||
227 | { | 239 | { |
228 | OSD osd = OSMaterials["Materials"]; | ||
229 | //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); | 240 | //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); |
230 | 241 | ||
231 | if (osd is OSDArray) | 242 | if (osdMaterials is OSDArray) |
232 | { | 243 | { |
233 | OSDArray matsArr = osd as OSDArray; | 244 | OSDArray matsArr = osdMaterials as OSDArray; |
234 | foreach (OSDMap matMap in matsArr) | 245 | foreach (OSDMap matMap in matsArr) |
235 | { | 246 | { |
236 | try | 247 | try |
@@ -268,8 +279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
268 | } | 279 | } |
269 | } | 280 | } |
270 | } | 281 | } |
271 | 282 | ||
272 | |||
273 | /// <summary> | 283 | /// <summary> |
274 | /// Get an asset synchronously, potentially using an asynchronous callback. If the | 284 | /// Get an asset synchronously, potentially using an asynchronous callback. If the |
275 | /// asynchronous callback is used, we will wait for it to complete. | 285 | /// asynchronous callback is used, we will wait for it to complete. |
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 4ab6609..3a39971 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | |||
@@ -121,9 +121,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
121 | return; | 121 | return; |
122 | 122 | ||
123 | m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 123 | m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
124 | |||
124 | m_scene = scene; | 125 | m_scene = scene; |
125 | m_scene.EventManager.OnRegisterCaps += new EventManager.RegisterCapsEvent(OnRegisterCaps); | 126 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
126 | m_scene.EventManager.OnObjectAddedToScene += new Action<SceneObjectGroup>(EventManager_OnObjectAddedToScene); | 127 | m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; |
128 | // m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids; | ||
127 | } | 129 | } |
128 | 130 | ||
129 | void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) | 131 | void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) |
@@ -157,6 +159,10 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
157 | if (!m_enabled) | 159 | if (!m_enabled) |
158 | return; | 160 | return; |
159 | 161 | ||
162 | m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | ||
163 | m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; | ||
164 | // m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids; | ||
165 | |||
160 | m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | 166 | m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName); |
161 | } | 167 | } |
162 | 168 | ||
@@ -167,18 +173,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
167 | OSDMap GetMaterial(UUID id) | 173 | OSDMap GetMaterial(UUID id) |
168 | { | 174 | { |
169 | OSDMap map = null; | 175 | OSDMap map = null; |
170 | if (m_knownMaterials.ContainsKey(id)) | 176 | lock (m_knownMaterials) |
171 | { | 177 | { |
172 | map = new OSDMap(); | 178 | if (m_knownMaterials.ContainsKey(id)) |
173 | map["ID"] = OSD.FromBinary(id.GetBytes()); | 179 | { |
174 | map["Material"] = m_knownMaterials[id]; | 180 | map = new OSDMap(); |
181 | map["ID"] = OSD.FromBinary(id.GetBytes()); | ||
182 | map["Material"] = m_knownMaterials[id]; | ||
183 | } | ||
175 | } | 184 | } |
176 | return map; | 185 | return map; |
177 | } | 186 | } |
178 | 187 | ||
179 | void GetStoredMaterialsForPart(SceneObjectPart part) | 188 | void GetStoredMaterialsForPart(SceneObjectPart part) |
180 | { | 189 | { |
181 | OSDMap OSMaterials = null; | 190 | OSD OSMaterials = null; |
182 | OSDArray matsArr = null; | 191 | OSDArray matsArr = null; |
183 | 192 | ||
184 | if (part.DynAttrs == null) | 193 | if (part.DynAttrs == null) |
@@ -188,23 +197,24 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
188 | 197 | ||
189 | lock (part.DynAttrs) | 198 | lock (part.DynAttrs) |
190 | { | 199 | { |
191 | if (part.DynAttrs.ContainsKey("OS:Materials")) | 200 | if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) |
192 | OSMaterials = part.DynAttrs["OS:Materials"]; | ||
193 | if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) | ||
194 | { | 201 | { |
202 | OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); | ||
195 | 203 | ||
196 | OSD osd = OSMaterials["Materials"]; | 204 | if (materialsStore == null) |
197 | if (osd is OSDArray) | 205 | return; |
198 | matsArr = osd as OSDArray; | 206 | |
207 | materialsStore.TryGetValue("Materials", out OSMaterials); | ||
199 | } | 208 | } |
200 | } | ||
201 | 209 | ||
202 | if (OSMaterials == null) | 210 | if (OSMaterials != null && OSMaterials is OSDArray) |
203 | return; | 211 | matsArr = OSMaterials as OSDArray; |
212 | else | ||
213 | return; | ||
214 | } | ||
204 | 215 | ||
205 | m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); | 216 | m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); |
206 | 217 | ||
207 | |||
208 | if (matsArr == null) | 218 | if (matsArr == null) |
209 | { | 219 | { |
210 | m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); | 220 | m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); |
@@ -215,13 +225,13 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
215 | { | 225 | { |
216 | if (elemOsd != null && elemOsd is OSDMap) | 226 | if (elemOsd != null && elemOsd is OSDMap) |
217 | { | 227 | { |
218 | |||
219 | OSDMap matMap = elemOsd as OSDMap; | 228 | OSDMap matMap = elemOsd as OSDMap; |
220 | if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) | 229 | if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) |
221 | { | 230 | { |
222 | try | 231 | try |
223 | { | 232 | { |
224 | m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"]; | 233 | lock (m_knownMaterials) |
234 | m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"]; | ||
225 | } | 235 | } |
226 | catch (Exception e) | 236 | catch (Exception e) |
227 | { | 237 | { |
@@ -232,7 +242,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
232 | } | 242 | } |
233 | } | 243 | } |
234 | 244 | ||
235 | |||
236 | void StoreMaterialsForPart(SceneObjectPart part) | 245 | void StoreMaterialsForPart(SceneObjectPart part) |
237 | { | 246 | { |
238 | try | 247 | try |
@@ -246,8 +255,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
246 | 255 | ||
247 | if (te.DefaultTexture != null) | 256 | if (te.DefaultTexture != null) |
248 | { | 257 | { |
249 | if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID)) | 258 | lock (m_knownMaterials) |
250 | mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID]; | 259 | { |
260 | if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID)) | ||
261 | mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID]; | ||
262 | } | ||
251 | } | 263 | } |
252 | 264 | ||
253 | if (te.FaceTextures != null) | 265 | if (te.FaceTextures != null) |
@@ -256,8 +268,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
256 | { | 268 | { |
257 | if (face != null) | 269 | if (face != null) |
258 | { | 270 | { |
259 | if (m_knownMaterials.ContainsKey(face.MaterialID)) | 271 | lock (m_knownMaterials) |
260 | mats[face.MaterialID] = m_knownMaterials[face.MaterialID]; | 272 | { |
273 | if (m_knownMaterials.ContainsKey(face.MaterialID)) | ||
274 | mats[face.MaterialID] = m_knownMaterials[face.MaterialID]; | ||
275 | } | ||
261 | } | 276 | } |
262 | } | 277 | } |
263 | } | 278 | } |
@@ -277,7 +292,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
277 | OSMaterials["Materials"] = matsArr; | 292 | OSMaterials["Materials"] = matsArr; |
278 | 293 | ||
279 | lock (part.DynAttrs) | 294 | lock (part.DynAttrs) |
280 | part.DynAttrs["OS:Materials"] = OSMaterials; | 295 | part.DynAttrs.SetStore("OpenSim", "Materials", OSMaterials); |
281 | } | 296 | } |
282 | catch (Exception e) | 297 | catch (Exception e) |
283 | { | 298 | { |
@@ -285,7 +300,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
285 | } | 300 | } |
286 | } | 301 | } |
287 | 302 | ||
288 | |||
289 | public string RenderMaterialsPostCap(string request, string path, | 303 | public string RenderMaterialsPostCap(string request, string path, |
290 | string param, IOSHttpRequest httpRequest, | 304 | string param, IOSHttpRequest httpRequest, |
291 | IOSHttpResponse httpResponse) | 305 | IOSHttpResponse httpResponse) |
@@ -319,18 +333,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
319 | try | 333 | try |
320 | { | 334 | { |
321 | UUID id = new UUID(elem.AsBinary(), 0); | 335 | UUID id = new UUID(elem.AsBinary(), 0); |
322 | 336 | ||
323 | if (m_knownMaterials.ContainsKey(id)) | 337 | lock (m_knownMaterials) |
324 | { | 338 | { |
325 | m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString()); | 339 | if (m_knownMaterials.ContainsKey(id)) |
326 | OSDMap matMap = new OSDMap(); | 340 | { |
327 | matMap["ID"] = OSD.FromBinary(id.GetBytes()); | 341 | m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString()); |
342 | OSDMap matMap = new OSDMap(); | ||
343 | matMap["ID"] = OSD.FromBinary(id.GetBytes()); | ||
328 | 344 | ||
329 | matMap["Material"] = m_knownMaterials[id]; | 345 | matMap["Material"] = m_knownMaterials[id]; |
330 | respArr.Add(matMap); | 346 | respArr.Add(matMap); |
347 | } | ||
348 | else | ||
349 | m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString()); | ||
331 | } | 350 | } |
332 | else | ||
333 | m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString()); | ||
334 | } | 351 | } |
335 | catch (Exception e) | 352 | catch (Exception e) |
336 | { | 353 | { |
@@ -368,7 +385,8 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
368 | m_log.Debug("[MaterialsDemoModule]: mat: " + OSDParser.SerializeJsonString(mat)); | 385 | m_log.Debug("[MaterialsDemoModule]: mat: " + OSDParser.SerializeJsonString(mat)); |
369 | 386 | ||
370 | UUID id = HashOsd(mat); | 387 | UUID id = HashOsd(mat); |
371 | m_knownMaterials[id] = mat; | 388 | lock (m_knownMaterials) |
389 | m_knownMaterials[id] = mat; | ||
372 | 390 | ||
373 | 391 | ||
374 | var sop = m_scene.GetSceneObjectPart(matLocalID); | 392 | var sop = m_scene.GetSceneObjectPart(matLocalID); |
@@ -476,24 +494,22 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
476 | m_log.Debug("[MaterialsDemoModule]: GET cap handler"); | 494 | m_log.Debug("[MaterialsDemoModule]: GET cap handler"); |
477 | 495 | ||
478 | OSDMap resp = new OSDMap(); | 496 | OSDMap resp = new OSDMap(); |
479 | |||
480 | |||
481 | int matsCount = 0; | 497 | int matsCount = 0; |
482 | |||
483 | OSDArray allOsd = new OSDArray(); | 498 | OSDArray allOsd = new OSDArray(); |
484 | 499 | ||
485 | foreach (KeyValuePair<UUID, OSDMap> kvp in m_knownMaterials) | 500 | lock (m_knownMaterials) |
486 | { | 501 | { |
487 | OSDMap matMap = new OSDMap(); | 502 | foreach (KeyValuePair<UUID, OSDMap> kvp in m_knownMaterials) |
488 | 503 | { | |
489 | matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes()); | 504 | OSDMap matMap = new OSDMap(); |
490 | 505 | ||
491 | matMap["Material"] = kvp.Value; | 506 | matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes()); |
492 | allOsd.Add(matMap); | 507 | matMap["Material"] = kvp.Value; |
493 | matsCount++; | 508 | allOsd.Add(matMap); |
509 | matsCount++; | ||
510 | } | ||
494 | } | 511 | } |
495 | 512 | ||
496 | |||
497 | resp["Zipped"] = ZCompressOSD(allOsd, false); | 513 | resp["Zipped"] = ZCompressOSD(allOsd, false); |
498 | m_log.Debug("[MaterialsDemoModule]: matsCount: " + matsCount.ToString()); | 514 | m_log.Debug("[MaterialsDemoModule]: matsCount: " + matsCount.ToString()); |
499 | 515 | ||
@@ -575,5 +591,72 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
575 | output.Flush(); | 591 | output.Flush(); |
576 | } | 592 | } |
577 | 593 | ||
594 | // FIXME: This code is currently still in UuidGatherer since we cannot use Scene.EventManager as some | ||
595 | // calls to the gatherer are done for objects with no scene. | ||
596 | // /// <summary> | ||
597 | // /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps | ||
598 | // /// </summary> | ||
599 | // /// <param name="part"></param> | ||
600 | // /// <param name="assetUuids"></param> | ||
601 | // private void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) | ||
602 | // { | ||
603 | // // scan thru the dynAttrs map of this part for any textures used as materials | ||
604 | // OSD osdMaterials = null; | ||
605 | // | ||
606 | // lock (part.DynAttrs) | ||
607 | // { | ||
608 | // if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) | ||
609 | // { | ||
610 | // OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); | ||
611 | // if (materialsStore == null) | ||
612 | // return; | ||
613 | // | ||
614 | // materialsStore.TryGetValue("Materials", out osdMaterials); | ||
615 | // } | ||
616 | // | ||
617 | // if (osdMaterials != null) | ||
618 | // { | ||
619 | // //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); | ||
620 | // | ||
621 | // if (osdMaterials is OSDArray) | ||
622 | // { | ||
623 | // OSDArray matsArr = osdMaterials as OSDArray; | ||
624 | // foreach (OSDMap matMap in matsArr) | ||
625 | // { | ||
626 | // try | ||
627 | // { | ||
628 | // if (matMap.ContainsKey("Material")) | ||
629 | // { | ||
630 | // OSDMap mat = matMap["Material"] as OSDMap; | ||
631 | // if (mat.ContainsKey("NormMap")) | ||
632 | // { | ||
633 | // UUID normalMapId = mat["NormMap"].AsUUID(); | ||
634 | // if (normalMapId != UUID.Zero) | ||
635 | // { | ||
636 | // assetUuids[normalMapId] = AssetType.Texture; | ||
637 | // //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); | ||
638 | // } | ||
639 | // } | ||
640 | // if (mat.ContainsKey("SpecMap")) | ||
641 | // { | ||
642 | // UUID specularMapId = mat["SpecMap"].AsUUID(); | ||
643 | // if (specularMapId != UUID.Zero) | ||
644 | // { | ||
645 | // assetUuids[specularMapId] = AssetType.Texture; | ||
646 | // //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); | ||
647 | // } | ||
648 | // } | ||
649 | // } | ||
650 | // | ||
651 | // } | ||
652 | // catch (Exception e) | ||
653 | // { | ||
654 | // m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message); | ||
655 | // } | ||
656 | // } | ||
657 | // } | ||
658 | // } | ||
659 | // } | ||
660 | // } | ||
578 | } | 661 | } |
579 | } \ No newline at end of file | 662 | } \ No newline at end of file |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index ff45d94..cc4325a 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -119,16 +119,14 @@ namespace OpenSim.Server.Handlers.Asset | |||
119 | 119 | ||
120 | if (asset == null || asset.Data.Length == 0) | 120 | if (asset == null || asset.Data.Length == 0) |
121 | { | 121 | { |
122 | MainConsole.Instance.Output("Asset not found"); | 122 | MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]); |
123 | return; | 123 | return; |
124 | } | 124 | } |
125 | 125 | ||
126 | m_AssetService.Delete(args[2]); | 126 | if (!m_AssetService.Delete(asset.ID)) |
127 | 127 | MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); | |
128 | //MainConsole.Instance.Output("Asset deleted"); | 128 | else |
129 | // TODO: Implement this | 129 | MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name); |
130 | |||
131 | MainConsole.Instance.Output("Asset deletion not supported by database"); | ||
132 | } | 130 | } |
133 | 131 | ||
134 | void HandleDumpAsset(string module, string[] args) | 132 | void HandleDumpAsset(string module, string[] args) |
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index 8a2ca7c..6047616 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs | |||
@@ -205,15 +205,16 @@ namespace OpenSim.Services.AssetService | |||
205 | if (!UUID.TryParse(id, out assetID)) | 205 | if (!UUID.TryParse(id, out assetID)) |
206 | return false; | 206 | return false; |
207 | 207 | ||
208 | // Don't bother deleting from a chained asset service. This isn't a big deal since deleting happens | 208 | if (HasChainedAssetService) |
209 | // very rarely. | 209 | m_ChainedAssetService.Delete(id); |
210 | 210 | ||
211 | return m_Database.Delete(id); | 211 | return m_Database.Delete(id); |
212 | } | 212 | } |
213 | 213 | ||
214 | private void MigrateFromChainedService(AssetBase asset) | 214 | private void MigrateFromChainedService(AssetBase asset) |
215 | { | 215 | { |
216 | Util.FireAndForget(o => { Store(asset); m_ChainedAssetService.Delete(asset.ID); }); | 216 | Store(asset); |
217 | m_ChainedAssetService.Delete(asset.ID); | ||
217 | } | 218 | } |
218 | } | 219 | } |
219 | } \ No newline at end of file | 220 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs index e984a54..622d4e1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs | |||
@@ -277,7 +277,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
277 | { | 277 | { |
278 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 278 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
279 | uri, | 279 | uri, |
280 | ServerUtils.BuildQueryString(sendData)); | 280 | ServerUtils.BuildQueryString(sendData), 15); |
281 | } | 281 | } |
282 | catch (Exception e) | 282 | catch (Exception e) |
283 | { | 283 | { |
diff --git a/bin/assets/TexturesAssetSet/IMG_BLOOM1.jp2 b/bin/assets/TexturesAssetSet/IMG_BLOOM1.jp2 new file mode 100644 index 0000000..8186d49 --- /dev/null +++ b/bin/assets/TexturesAssetSet/IMG_BLOOM1.jp2 | |||
Binary files differ | |||
diff --git a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml index a4a0cba..a29ac38 100644 --- a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml +++ b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml | |||
@@ -746,4 +746,16 @@ | |||
746 | <Key Name="assetType" Value="0" /> | 746 | <Key Name="assetType" Value="0" /> |
747 | <Key Name="fileName" Value="735198cf-6ea0-2550-e222-21d3c6a341ae.j2c" /> | 747 | <Key Name="fileName" Value="735198cf-6ea0-2550-e222-21d3c6a341ae.j2c" /> |
748 | </Section> | 748 | </Section> |
749 | |||
750 | <!-- | ||
751 | Texture expected by viewers for properly displaying stars in the night sky | ||
752 | Name derives from label in viewer code | ||
753 | --> | ||
754 | <Section Name="IMG_BLOOM1 Texture"> | ||
755 | <Key Name="assetID" Value="3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"/> | ||
756 | <Key Name="name" Value="IMG_BLOOM1 Texture"/> | ||
757 | <Key Name="assetType" Value="0" /> | ||
758 | <Key Name="fileName" Value="IMG_BLOOM1.jp2" /> | ||
759 | </Section> | ||
760 | |||
749 | </Nini> | 761 | </Nini> |