aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-11-02 19:55:27 +0000
committerMelanie2010-11-02 19:55:27 +0000
commite327e990f5ab61fdd4065bf55c081b973a247774 (patch)
treeb9afbb010b4efe39b888da7eecaaa5d8cbcdd45c /OpenSim
parentTry to not make avatars switch outfits (diff)
parentOld deserialization can't deal with commas in flag fields. Making use of -ver... (diff)
downloadopensim-SC-e327e990f5ab61fdd4065bf55c081b973a247774.zip
opensim-SC-e327e990f5ab61fdd4065bf55c081b973a247774.tar.gz
opensim-SC-e327e990f5ab61fdd4065bf55c081b973a247774.tar.bz2
opensim-SC-e327e990f5ab61fdd4065bf55c081b973a247774.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs5
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs64
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs20
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs29
7 files changed, 92 insertions, 56 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 7a0142f..f80cb34 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -264,9 +264,10 @@ namespace OpenSim
264 LoadOar); 264 LoadOar);
265 265
266 m_console.Commands.AddCommand("region", false, "save oar", 266 m_console.Commands.AddCommand("region", false, "save oar",
267 "save oar [<OAR path>]", 267 "save oar [-v|version=N] [<OAR path>]",
268 "Save a region's data to an OAR archive.", 268 "Save a region's data to an OAR archive.",
269 "The OAR path must be a filesystem path." 269 "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
270 + "The OAR path must be a filesystem path."
270 + " If this is not given then the oar is saved to region.oar in the current directory.", 271 + " If this is not given then the oar is saved to region.oar in the current directory.",
271 SaveOar); 272 SaveOar);
272 273
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index c23cea5..ed3e516 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
176 stream = response.GetResponseStream(); 176 stream = response.GetResponseStream();
177 if (stream != null) 177 if (stream != null)
178 { 178 {
179 Bitmap image = new Bitmap(stream);
180 Size newsize;
181
182 // TODO: make this a bit less hard coded
183 if ((image.Height < 64) && (image.Width < 64))
184 {
185 newsize = new Size(32, 32);
186 }
187 else if ((image.Height < 128) && (image.Width < 128))
188 {
189 newsize = new Size(64, 64);
190 }
191 else if ((image.Height < 256) && (image.Width < 256))
192 {
193 newsize = new Size(128, 128);
194 }
195 else if ((image.Height < 512 && image.Width < 512))
196 {
197 newsize = new Size(256, 256);
198 }
199 else if ((image.Height < 1024 && image.Width < 1024))
200 {
201 newsize = new Size(512, 512);
202 }
203 else
204 {
205 newsize = new Size(1024, 1024);
206 }
207
208 Bitmap resize = new Bitmap(image, newsize);
209
210 try 179 try
211 { 180 {
181 Bitmap image = new Bitmap(stream);
182 Size newsize;
183
184 // TODO: make this a bit less hard coded
185 if ((image.Height < 64) && (image.Width < 64))
186 {
187 newsize = new Size(32, 32);
188 }
189 else if ((image.Height < 128) && (image.Width < 128))
190 {
191 newsize = new Size(64, 64);
192 }
193 else if ((image.Height < 256) && (image.Width < 256))
194 {
195 newsize = new Size(128, 128);
196 }
197 else if ((image.Height < 512 && image.Width < 512))
198 {
199 newsize = new Size(256, 256);
200 }
201 else if ((image.Height < 1024 && image.Width < 1024))
202 {
203 newsize = new Size(512, 512);
204 }
205 else
206 {
207 newsize = new Size(1024, 1024);
208 }
209
210 Bitmap resize = new Bitmap(image, newsize);
211
212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
213 } 213 }
214 catch (Exception) 214 catch (Exception)
215 { 215 {
216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); 216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!");
217 } 217 }
218 } 218 }
219 else 219 else
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 34205e3..bd01bb9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
261 261
262 public InventoryItemBase GetItem(InventoryItemBase item) 262 public InventoryItemBase GetItem(InventoryItemBase item)
263 { 263 {
264 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID); 264 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
265 if (item == null) 265 if (item == null)
266 return null; 266 return null;
267 267
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
272 272
273 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 273 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
274 { 274 {
275 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); 275 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
276 if (folder == null) 276 if (folder == null)
277 return null; 277 return null;
278 278
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index c062833..f8a599a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 137
138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
139 139
140 Dictionary<string, object> serializationOptions = new Dictionary<string, object>(); 140
141// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0")
142// serializationOptions["old-guids"] = true;
143
144 // Write out scene object metadata 141 // Write out scene object metadata
145 foreach (SceneObjectGroup sceneObject in m_sceneObjects) 142 foreach (SceneObjectGroup sceneObject in m_sceneObjects)
146 { 143 {
147 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 144 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
148 145
149 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); 146 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
150 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); 147 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
151 } 148 }
152 149
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 3182079..0567a82 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
187 /// <returns></returns> 187 /// <returns></returns>
188 public static string Create0p2ControlFile(Dictionary<string, object> options) 188 public static string Create0p2ControlFile(Dictionary<string, object> options)
189 { 189 {
190 int majorVersion = 0, minorVersion = 4; 190 int majorVersion = 0, minorVersion = 5;
191 191
192 /* 192 if (options.ContainsKey("version"))
193 if (options.ContainsKey("version") && (string)options["version"] == "0")
194 {
195 majorVersion = 0;
196 minorVersion = 3;
197 }
198 else
199 { 193 {
200 majorVersion = 1;
201 minorVersion = 0; 194 minorVersion = 0;
195 string[] parts = options["version"].ToString().Split('.');
196 if (parts.Length >= 1)
197 majorVersion = Int32.Parse(parts[0]);
198 if (parts.Length >= 2)
199 minorVersion = Int32.Parse(parts[1]);
202 } 200 }
203 */
204 201
205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 202 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
206// if (majorVersion == 1) 203// if (majorVersion == 1)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e661ca9..7f37878 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); 1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); 1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
1138 writer.WriteElementString("Flags", sop.Flags.ToString()); 1138 WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); 1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1141 if (sop.MediaUrl != null) 1141 if (sop.MediaUrl != null)
@@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1188 1188
1189 } 1189 }
1190 1190
1191 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1192 {
1193 // Older versions of serialization can't cope with commas
1194 if (options.ContainsKey("version"))
1195 {
1196 float version = 0.5F;
1197 float.TryParse(options["version"].ToString(), out version);
1198 if (version < 0.5)
1199 flagsStr = flagsStr.Replace(",", "");
1200 }
1201
1202 writer.WriteElementString(name, flagsStr);
1203 }
1204
1191 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) 1205 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
1192 { 1206 {
1193 if (tinv.Count > 0) // otherwise skip this 1207 if (tinv.Count > 0) // otherwise skip this
@@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1275 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1289 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1276 writer.WriteElementString("State", shp.State.ToString()); 1290 writer.WriteElementString("State", shp.State.ToString());
1277 1291
1278 writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); 1292 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1279 writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); 1293 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
1280 1294
1281 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1295 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1282 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1296 writer.WriteElementString("SculptType", shp.SculptType.ToString());
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 77230a3..ee06225 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces
97 int GetRegionFlags(UUID scopeID, UUID regionID); 97 int GetRegionFlags(UUID scopeID, UUID regionID);
98 } 98 }
99 99
100 public class GridRegion 100 public class GridRegion : Object
101 { 101 {
102 102
103 /// <summary> 103 /// <summary>
@@ -225,6 +225,33 @@ namespace OpenSim.Services.Interfaces
225 EstateOwner = ConvertFrom.EstateOwner; 225 EstateOwner = ConvertFrom.EstateOwner;
226 } 226 }
227 227
228 # region Definition of equality
229
230 /// <summary>
231 /// Define equality as two regions having the same, non-zero UUID.
232 /// </summary>
233 public bool Equals(GridRegion region)
234 {
235 if ((object)region == null)
236 return false;
237 // Return true if the non-zero UUIDs are equal:
238 return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID);
239 }
240
241 public override bool Equals(Object obj)
242 {
243 if (obj == null)
244 return false;
245 return Equals(obj as GridRegion);
246 }
247
248 public override int GetHashCode()
249 {
250 return RegionID.GetHashCode() ^ TerrainImage.GetHashCode();
251 }
252
253 #endregion
254
228 /// <value> 255 /// <value>
229 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. 256 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
230 /// 257 ///