Merge git://github.com/opensim/opensim into mantis5110

This commit is contained in:
Jonathan Freedman
2010-11-05 19:10:02 -07:00
32 changed files with 295 additions and 91 deletions

View File

@@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare
}
private void EventManager_OnSaveNewWindlightProfile()
{
m_scene.ForEachScenePresence(SendProfileToClient);
if (m_scene.RegionInfo.WindlightSettings.valid)
m_scene.ForEachScenePresence(SendProfileToClient);
}
public void PostInitialise()

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

@@ -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

@@ -31,12 +31,14 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using System.Reflection;
using log4net;
namespace OpenSim.Region.CoreModules.World.Sound
{
public class SoundModule : IRegionModule, ISoundModule
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene;
@@ -62,6 +64,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
public virtual void PlayAttachedSound(
UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return;
SceneObjectGroup grp = part.ParentGroup;
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)
@@ -71,12 +79,25 @@ namespace OpenSim.Region.CoreModules.World.Sound
if (dis > 100.0) // Max audio distance
return;
if (grp.IsAttachment)
{
if (grp.GetAttachmentPoint() > 30) // HUD
{
if (sp.ControllingClient.AgentId != grp.OwnerID)
return;
}
if (sp.ControllingClient.AgentId == grp.OwnerID)
dis = 0;
}
// Scale by distance
if (radius == 0)
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
else
gain = (float)((double)gain * ((radius - dis) / radius));
m_log.DebugFormat("Play sound, gain {0}", gain);
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
});
}
@@ -84,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound
public virtual void TriggerSound(
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return;
SceneObjectGroup grp = part.ParentGroup;
if (grp.IsAttachment && grp.GetAttachmentPoint() > 30)
{
objectID = ownerID;
parentID = ownerID;
}
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)