diff options
author | Justin Clark-Casey (justincc) | 2013-06-27 23:14:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-27 23:14:28 +0100 |
commit | f7d09b898ad6df32b3f07cb64657623980178c2f (patch) | |
tree | f7f2b1117e9843267dab89993ad6d5492c1b3cc8 /OpenSim/Region/OptionalModules | |
parent | Update temporary "Unknown UserUMMTGUN2" name to "Unknown UserUMMTGUN3" to see... (diff) | |
download | opensim-SC-f7d09b898ad6df32b3f07cb64657623980178c2f.zip opensim-SC-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.gz opensim-SC-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.bz2 opensim-SC-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.xz |
Make the concept of namespaces explicit in dynamic attributes
This is in order to reduce the likelihood of naming clashes, make it easier to filter in/out attributes, ensure uniformity, etc.
All dynattrs in the opensim distro itself or likely future ones should be in the "OpenSim" namespace.
This does alter the underlying dynattrs data structure. All data in previous structures may not be available, though old structures should not cause errors.
This is done without notice since this feature has been explicitly labelled as experimental, subject to change and has not been in a release.
However, existing materials data is being preserved by moving it to the "Materials" store in the "OpenSim" namespace.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 4ab6609..5b15a73 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | |||
@@ -178,7 +178,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
178 | 178 | ||
179 | void GetStoredMaterialsForPart(SceneObjectPart part) | 179 | void GetStoredMaterialsForPart(SceneObjectPart part) |
180 | { | 180 | { |
181 | OSDMap OSMaterials = null; | 181 | OSD OSMaterials = null; |
182 | OSDArray matsArr = null; | 182 | OSDArray matsArr = null; |
183 | 183 | ||
184 | if (part.DynAttrs == null) | 184 | if (part.DynAttrs == null) |
@@ -188,23 +188,20 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
188 | 188 | ||
189 | lock (part.DynAttrs) | 189 | lock (part.DynAttrs) |
190 | { | 190 | { |
191 | if (part.DynAttrs.ContainsKey("OS:Materials")) | 191 | if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) |
192 | OSMaterials = part.DynAttrs["OS:Materials"]; | ||
193 | if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) | ||
194 | { | 192 | { |
195 | 193 | OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); | |
196 | OSD osd = OSMaterials["Materials"]; | 194 | materialsStore.TryGetValue("Materials", out OSMaterials); |
197 | if (osd is OSDArray) | ||
198 | matsArr = osd as OSDArray; | ||
199 | } | 195 | } |
200 | } | ||
201 | 196 | ||
202 | if (OSMaterials == null) | 197 | if (OSMaterials != null && OSMaterials is OSDArray) |
203 | return; | 198 | matsArr = OSMaterials as OSDArray; |
199 | else | ||
200 | return; | ||
201 | } | ||
204 | 202 | ||
205 | m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); | 203 | m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); |
206 | 204 | ||
207 | |||
208 | if (matsArr == null) | 205 | if (matsArr == null) |
209 | { | 206 | { |
210 | m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); | 207 | m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); |
@@ -215,7 +212,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
215 | { | 212 | { |
216 | if (elemOsd != null && elemOsd is OSDMap) | 213 | if (elemOsd != null && elemOsd is OSDMap) |
217 | { | 214 | { |
218 | |||
219 | OSDMap matMap = elemOsd as OSDMap; | 215 | OSDMap matMap = elemOsd as OSDMap; |
220 | if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) | 216 | if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) |
221 | { | 217 | { |
@@ -232,7 +228,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
232 | } | 228 | } |
233 | } | 229 | } |
234 | 230 | ||
235 | |||
236 | void StoreMaterialsForPart(SceneObjectPart part) | 231 | void StoreMaterialsForPart(SceneObjectPart part) |
237 | { | 232 | { |
238 | try | 233 | try |
@@ -277,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
277 | OSMaterials["Materials"] = matsArr; | 272 | OSMaterials["Materials"] = matsArr; |
278 | 273 | ||
279 | lock (part.DynAttrs) | 274 | lock (part.DynAttrs) |
280 | part.DynAttrs["OS:Materials"] = OSMaterials; | 275 | part.DynAttrs.SetStore("OpenSim", "Materials", OSMaterials); |
281 | } | 276 | } |
282 | catch (Exception e) | 277 | catch (Exception e) |
283 | { | 278 | { |
@@ -285,7 +280,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
285 | } | 280 | } |
286 | } | 281 | } |
287 | 282 | ||
288 | |||
289 | public string RenderMaterialsPostCap(string request, string path, | 283 | public string RenderMaterialsPostCap(string request, string path, |
290 | string param, IOSHttpRequest httpRequest, | 284 | string param, IOSHttpRequest httpRequest, |
291 | IOSHttpResponse httpResponse) | 285 | IOSHttpResponse httpResponse) |