Compare commits

...

8 Commits

Author SHA1 Message Date
BlueWall
5eb2526e88 0006270: Warp3D leaks memory on mono based systems
Thanks Hiro Lecker for a patch to reduce memory useage with Warp3D map module
2012-09-06 05:18:08 -04:00
Mic Bowman
641b08aa78 Enables cast from int to float for MOD* functions;
Thanks SignpostMarv!
2012-09-05 09:13:16 -07:00
Justin Clark-Casey (justincc)
15d5f3d09d Bump master code up to 0.7.5 now that 0.7.4 is out. 2012-09-04 00:11:14 +01:00
SignpostMarv
07dbe46ba3 wrapping attachment functions in a region 2012-09-04 00:03:44 +01:00
SignpostMarv
ff867b59cf Implementing functing to send messages directly to attachments 2012-09-04 00:03:44 +01:00
SignpostMarv
d4b8a13a1d refactoring the grunt work of MessageObject into a private method with a UUID argument 2012-09-04 00:03:44 +01:00
SignpostMarv
a858c5daee implementing a function to get the number of attachments worn 2012-09-04 00:03:43 +01:00
SignpostMarv
8d431c6359 formatting 2012-09-04 00:03:43 +01:00
9 changed files with 278 additions and 11 deletions

View File

@@ -92,6 +92,7 @@ what it is today.
* Flyte Xevious
* Garmin Kawaguichi
* Gryc Ueusp
* Hiro Lecker
* Imaze Rhiano
* Intimidated
* Jeremy Bongio (IBM)

View File

@@ -29,7 +29,7 @@ namespace OpenSim
{
public class VersionInfo
{
private const string VERSION_NUMBER = "0.7.4";
private const string VERSION_NUMBER = "0.7.5";
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
public enum Flavour

View File

@@ -208,6 +208,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
bitmap = ImageUtils.ResizeImage(origBitmap, viewport.Width, viewport.Height);
}
GC.Collect();
m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()");
return bitmap;
}
@@ -673,4 +676,4 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
return result;
}
}
}
}

View File

@@ -3421,15 +3421,15 @@ namespace OpenSim.Region.Framework.Scenes
if (attachmentPoint >= 0)
{
lock (m_attachments)
{
foreach (SceneObjectGroup so in m_attachments)
lock (m_attachments)
{
if (attachmentPoint == so.AttachmentPoint)
attachments.Add(so);
foreach (SceneObjectGroup so in m_attachments)
{
if (attachmentPoint == so.AttachmentPoint)
attachments.Add(so);
}
}
}
}
return attachments;
}

View File

@@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// ---------- Integer ----------
else if (lslparm is LSL_Integer)
{
if (type == typeof(int))
if (type == typeof(int) || type == typeof(float))
return (int)(LSL_Integer)lslparm;
}

View File

@@ -1673,6 +1673,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
MessageObject(objUUID, message);
}
private void MessageObject(UUID objUUID, string message)
{
object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID);
@@ -3224,6 +3229,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
#region Attachment commands
public void osForceAttachToAvatar(int attachmentPoint)
{
CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
@@ -3313,6 +3320,175 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
((LSL_Api)m_LSL_Api).DetachFromAvatar();
}
public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");
m_host.AddScriptLPS(1);
UUID targetUUID;
ScenePresence target;
LSL_List resp = new LSL_List();
if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
{
foreach (object point in attachmentPoints.Data)
{
LSL_Integer ipoint = new LSL_Integer(
(point is LSL_Integer || point is int || point is uint) ?
(int)point :
0
);
resp.Add(ipoint);
if (ipoint == 0)
{
// indicates zero attachments
resp.Add(new LSL_Integer(0));
}
else
{
// gets the number of attachments on the attachment point
resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
}
}
}
return resp;
}
public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options)
{
CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments");
m_host.AddScriptLPS(1);
UUID targetUUID;
ScenePresence target;
if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
{
List<int> aps = new List<int>();
foreach (object point in attachmentPoints.Data)
{
int ipoint;
if (int.TryParse(point.ToString(), out ipoint))
{
aps.Add(ipoint);
}
}
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
if (msgAll && invertPoints)
{
return;
}
else if (msgAll || invertPoints)
{
attachments = target.GetAttachments();
}
else
{
foreach (int point in aps)
{
if (point > 0)
{
attachments.AddRange(target.GetAttachments((uint)point));
}
}
}
// if we have no attachments at this point, exit now
if (attachments.Count == 0)
{
return;
}
List<SceneObjectGroup> ignoreThese = new List<SceneObjectGroup>();
if (invertPoints)
{
foreach (SceneObjectGroup attachment in attachments)
{
if (aps.Contains((int)attachment.AttachmentPoint))
{
ignoreThese.Add(attachment);
}
}
}
foreach (SceneObjectGroup attachment in ignoreThese)
{
attachments.Remove(attachment);
}
ignoreThese.Clear();
// if inverting removed all attachments to check, exit now
if (attachments.Count < 1)
{
return;
}
if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0)
{
foreach (SceneObjectGroup attachment in attachments)
{
if (attachment.RootPart.CreatorID != m_host.CreatorID)
{
ignoreThese.Add(attachment);
}
}
foreach (SceneObjectGroup attachment in ignoreThese)
{
attachments.Remove(attachment);
}
ignoreThese.Clear();
// if filtering by same object creator removed all
// attachments to check, exit now
if (attachments.Count == 0)
{
return;
}
}
if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0)
{
foreach (SceneObjectGroup attachment in attachments)
{
if (attachment.RootPart.CreatorID != m_item.CreatorID)
{
ignoreThese.Add(attachment);
}
}
foreach (SceneObjectGroup attachment in ignoreThese)
{
attachments.Remove(attachment);
}
ignoreThese.Clear();
// if filtering by object creator must match originating
// script creator removed all attachments to check,
// exit now
if (attachments.Count == 0)
{
return;
}
}
foreach (SceneObjectGroup attachment in attachments)
{
MessageObject(attachment.RootPart.UUID, message);
}
}
}
#endregion
/// <summary>
/// Checks if thing is a UUID.
/// </summary>

View File

@@ -157,7 +157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
// Attachment commands
#region Attachment commands
/// <summary>
/// Attach the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH
@@ -192,6 +192,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// <remarks>Nothing happens if the object is not attached.</remarks>
void osForceDetachFromAvatar();
/// <summary>
/// Returns a strided list of the specified attachment points and the number of attachments on those points.
/// </summary>
/// <param name="avatar">avatar UUID</param>
/// <param name="attachmentPoints">list of ATTACH_* constants</param>
/// <returns></returns>
LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints);
/// <summary>
/// Sends a specified message to the specified avatar's attachments on
/// the specified attachment points.
/// </summary>
/// <remarks>
/// Behaves as osMessageObject(), without the sending script needing to know the attachment keys in advance.
/// </remarks>
/// <param name="avatar">avatar UUID</param>
/// <param name="message">message string</param>
/// <param name="attachmentPoints">list of ATTACH_* constants, or -1 for all attachments. If -1 is specified and OS_ATTACH_MSG_INVERT_POINTS is present in flags, no action is taken.</param>
/// <param name="flags">flags further constraining the attachments to deliver the message to.</param>
void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags);
#endregion
//texture draw functions
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);

View File

@@ -237,6 +237,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int ATTACH_HUD_BOTTOM = 37;
public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
#region osMessageAttachments constants
/// <summary>
/// Instructs osMessageAttachements to send the message to attachments
/// on every point.
/// </summary>
/// <remarks>
/// One might expect this to be named OS_ATTACH_ALL, but then one might
/// also expect functions designed to attach or detach or get
/// attachments to work with it too. Attaching a no-copy item to
/// many attachments could be dangerous.
/// when combined with OS_ATTACH_MSG_INVERT_POINTS, will prevent the
/// message from being sent.
/// if combined with OS_ATTACH_MSG_OBJECT_CREATOR or
/// OS_ATTACH_MSG_SCRIPT_CREATOR, could result in no message being
/// sent- this is expected behaviour.
/// </remarks>
public const int OS_ATTACH_MSG_ALL = -65535;
/// <summary>
/// Instructs osMessageAttachements to invert how the attachment points
/// list should be treated (e.g. go from inclusive operation to
/// exclusive operation).
/// </summary>
/// <remarks>
/// This might be used if you want to deliver a message to one set of
/// attachments and a different message to everything else. With
/// this flag, you only need to build one explicit list for both calls.
/// </remarks>
public const int OS_ATTACH_MSG_INVERT_POINTS = 1;
/// <summary>
/// Instructs osMessageAttachments to only send the message to
/// attachments with a CreatorID that matches the host object CreatorID
/// </summary>
/// <remarks>
/// This would be used if distributed in an object vendor/updater server.
/// </remarks>
public const int OS_ATTACH_MSG_OBJECT_CREATOR = 2;
/// <summary>
/// Instructs osMessageAttachments to only send the message to
/// attachments with a CreatorID that matches the sending script CreatorID
/// </summary>
/// <remarks>
/// This might be used if the script is distributed independently of a
/// containing object.
/// </remarks>
public const int OS_ATTACH_MSG_SCRIPT_CREATOR = 4;
#endregion
public const int LAND_LEVEL = 0;
public const int LAND_RAISE = 1;
public const int LAND_LOWER = 2;

View File

@@ -289,7 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
// Avatar functions
#region Attachment commands
public void osForceAttachToAvatar(int attachmentPoint)
{
@@ -311,6 +311,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osForceDetachFromAvatar();
}
public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
{
return m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints);
}
public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags)
{
m_OSSL_Functions.osMessageAttachments(avatar, message, attachmentPoints, flags);
}
#endregion
// Texture Draw functions
public string osMovePen(string drawList, int x, int y)