Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

viewer-2-initial-appearance
Melanie 2010-11-02 19:55:27 +00:00
commit e327e990f5
7 changed files with 92 additions and 56 deletions

View File

@ -264,9 +264,10 @@ namespace OpenSim
LoadOar);
m_console.Commands.AddCommand("region", false, "save oar",
"save oar [<OAR path>]",
"save oar [-v|version=N] [<OAR path>]",
"Save a region's data to an OAR archive.",
"The OAR path must be a filesystem path."
"-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
+ "The OAR path must be a filesystem path."
+ " If this is not given then the oar is saved to region.oar in the current directory.",
SaveOar);

View File

@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
stream = response.GetResponseStream();
if (stream != null)
{
Bitmap image = new Bitmap(stream);
Size newsize;
// TODO: make this a bit less hard coded
if ((image.Height < 64) && (image.Width < 64))
{
newsize = new Size(32, 32);
}
else if ((image.Height < 128) && (image.Width < 128))
{
newsize = new Size(64, 64);
}
else if ((image.Height < 256) && (image.Width < 256))
{
newsize = new Size(128, 128);
}
else if ((image.Height < 512 && image.Width < 512))
{
newsize = new Size(256, 256);
}
else if ((image.Height < 1024 && image.Width < 1024))
{
newsize = new Size(512, 512);
}
else
{
newsize = new Size(1024, 1024);
}
Bitmap resize = new Bitmap(image, newsize);
try
{
Bitmap image = new Bitmap(stream);
Size newsize;
// TODO: make this a bit less hard coded
if ((image.Height < 64) && (image.Width < 64))
{
newsize = new Size(32, 32);
}
else if ((image.Height < 128) && (image.Width < 128))
{
newsize = new Size(64, 64);
}
else if ((image.Height < 256) && (image.Width < 256))
{
newsize = new Size(128, 128);
}
else if ((image.Height < 512 && image.Width < 512))
{
newsize = new Size(256, 256);
}
else if ((image.Height < 1024 && image.Width < 1024))
{
newsize = new Size(512, 512);
}
else
{
newsize = new Size(1024, 1024);
}
Bitmap resize = new Bitmap(image, newsize);
imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
}
catch (Exception)
{
m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!");
}
}
else

View File

@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public InventoryItemBase GetItem(InventoryItemBase item)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null)
return null;
@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null)
return null;

View File

@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
Dictionary<string, object> serializationOptions = new Dictionary<string, object>();
// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0")
// serializationOptions["old-guids"] = true;
// Write out scene object metadata
foreach (SceneObjectGroup sceneObject in m_sceneObjects)
{
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions);
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
}

View File

@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <returns></returns>
public static string Create0p2ControlFile(Dictionary<string, object> options)
{
int majorVersion = 0, minorVersion = 4;
/*
if (options.ContainsKey("version") && (string)options["version"] == "0")
int majorVersion = 0, minorVersion = 5;
if (options.ContainsKey("version"))
{
majorVersion = 0;
minorVersion = 3;
}
else
{
majorVersion = 1;
minorVersion = 0;
string[] parts = options["version"].ToString().Split('.');
if (parts.Length >= 1)
majorVersion = Int32.Parse(parts[0]);
if (parts.Length >= 2)
minorVersion = Int32.Parse(parts[1]);
}
*/
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
// if (majorVersion == 1)

View File

@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
writer.WriteElementString("Flags", sop.Flags.ToString());
WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
if (sop.MediaUrl != null)
@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
{
// Older versions of serialization can't cope with commas
if (options.ContainsKey("version"))
{
float version = 0.5F;
float.TryParse(options["version"].ToString(), out version);
if (version < 0.5)
flagsStr = flagsStr.Replace(",", "");
}
writer.WriteElementString(name, flagsStr);
}
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
{
if (tinv.Count > 0) // otherwise skip this
@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
writer.WriteElementString("State", shp.State.ToString());
writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString());
writer.WriteElementString("HollowShape", shp.HollowShape.ToString());
WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
writer.WriteElementString("SculptType", shp.SculptType.ToString());

View File

@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces
int GetRegionFlags(UUID scopeID, UUID regionID);
}
public class GridRegion
public class GridRegion : Object
{
/// <summary>
@ -225,6 +225,33 @@ namespace OpenSim.Services.Interfaces
EstateOwner = ConvertFrom.EstateOwner;
}
# region Definition of equality
/// <summary>
/// Define equality as two regions having the same, non-zero UUID.
/// </summary>
public bool Equals(GridRegion region)
{
if ((object)region == null)
return false;
// Return true if the non-zero UUIDs are equal:
return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID);
}
public override bool Equals(Object obj)
{
if (obj == null)
return false;
return Equals(obj as GridRegion);
}
public override int GetHashCode()
{
return RegionID.GetHashCode() ^ TerrainImage.GetHashCode();
}
#endregion
/// <value>
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
///