diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 449e1d2aba..3a0e1b9466 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1249,6 +1249,7 @@ namespace OpenSim.Region.Environment.Scenes
return avatar;
}
+
protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{
if (m_AvatarFactory == null ||
@@ -2190,6 +2191,12 @@ namespace OpenSim.Region.Environment.Scenes
scriptEngine.InitializeEngine(this, logger);
}
+ public void TriggerObjectChanged(uint localID, uint change)
+ {
+
+ m_eventManager.TriggerOnScriptChangedEvent(localID, change);
+ }
+
#endregion
#region InnerScene wrapper methods
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 739f86d6ad..4e9a258b35 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -125,7 +125,15 @@ namespace OpenSim.Region.Environment.Scenes
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
+ public delegate void ScriptChangedEvent(uint localID, uint change);
+
+ public event ScriptChangedEvent OnScriptChangedEvent;
+ public void TriggerOnScriptChangedEvent(uint localID, uint change)
+ {
+ if (OnScriptChangedEvent != null)
+ OnScriptChangedEvent(localID,change);
+ }
public void TriggerOnClientMovement(ScenePresence avatar)
{
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index be2ddaea02..1a9e6c4035 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -203,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
lock (m_taskInventory)
{
m_taskInventory.Add(item.ItemID, item);
+ TriggerScriptChangedEvent(Changed.INVENTORY);
}
m_inventorySerial++;
@@ -220,6 +221,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (TaskInventoryItem item in items)
{
m_taskInventory.Add(item.ItemID, item);
+ TriggerScriptChangedEvent(Changed.INVENTORY);
}
}
@@ -265,7 +267,8 @@ namespace OpenSim.Region.Environment.Scenes
{
m_taskInventory[item.ItemID] = item;
m_inventorySerial++;
-
+ TriggerScriptChangedEvent(Changed.INVENTORY);
+
return true;
}
else
@@ -295,6 +298,7 @@ namespace OpenSim.Region.Environment.Scenes
int type = m_taskInventory[itemID].InvType;
m_taskInventory.Remove(itemID);
m_inventorySerial++;
+ TriggerScriptChangedEvent(Changed.INVENTORY);
return type;
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 786673977d..0cb4ae74be 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -42,6 +42,23 @@ using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
+ // I don't really know where to put this except here.
+ // Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
+
+ [Flags]
+ public enum Changed : uint
+ {
+ INVENTORY = 1,
+ COLOR = 2,
+ SHAPE = 4,
+ SCALE = 8,
+ TEXTURE = 16,
+ LINK = 32,
+ ALLOWED_DROP = 64,
+ OWNER = 128
+ }
+
+
public partial class SceneObjectPart : IScriptHost
{
private const PermissionMask OBJFULL_MASK_GENERAL =
@@ -94,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes
private byte m_updateFlag;
#region Properties
-
+
public LLUUID CreatorID;
public LLUUID ObjectCreator
@@ -160,7 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
/// A Linked Child Prim objects position in world
public LLVector3 GetWorldPosition()
{
-
+
Quaternion parentRot = new Quaternion(
ParentGroup.RootPart.RotationOffset.W,
ParentGroup.RootPart.RotationOffset.X,
@@ -186,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public LLQuaternion GetWorldRotation()
{
+
Quaternion newRot;
if (this.LinkNum == 0)
@@ -277,6 +295,7 @@ namespace OpenSim.Region.Environment.Scenes
{
// Hack to get the child prim to update world positions in the physics engine
ParentGroup.ResetChildPrimPhysicsPositions();
+
}
catch (System.NullReferenceException)
{
@@ -427,6 +446,8 @@ namespace OpenSim.Region.Environment.Scenes
set
{
m_color = value;
+ TriggerScriptChangedEvent(Changed.COLOR);
+
/* ScheduleFullUpdate() need not be called b/c after
* setting the color, the text will be set, so then
* ScheduleFullUpdate() will be called. */
@@ -477,7 +498,12 @@ namespace OpenSim.Region.Environment.Scenes
public int LinkNum
{
get { return m_linkNum; }
- set { m_linkNum = value; }
+ set
+ {
+ m_linkNum = value;
+ TriggerScriptChangedEvent(Changed.LINK);
+
+ }
}
private byte m_clickAction = 0;
@@ -494,16 +520,35 @@ namespace OpenSim.Region.Environment.Scenes
protected PrimitiveBaseShape m_shape;
+ public void TriggerScriptChangedEvent(Changed val)
+ {
+ if (m_parentGroup != null)
+ {
+ if (m_parentGroup.Scene != null)
+ m_parentGroup.Scene.TriggerObjectChanged(LocalID, (uint)val);
+ }
+
+ }
+
public PrimitiveBaseShape Shape
{
get { return m_shape; }
- set { m_shape = value; }
+ set
+ {
+
+ m_shape = value;
+ TriggerScriptChangedEvent(Changed.SHAPE);
+ }
}
public LLVector3 Scale
{
- set { m_shape.Scale = value; }
get { return m_shape.Scale; }
+ set
+ {
+ m_shape.Scale = value;
+ TriggerScriptChangedEvent(Changed.SCALE);
+ }
}
public bool Stopped
@@ -692,6 +737,8 @@ namespace OpenSim.Region.Environment.Scenes
{
BaseMask = NextOwnerMask;
OwnerMask = NextOwnerMask;
+ TriggerScriptChangedEvent(Changed.OWNER);
+
}
public void ApplySanePermissions()
@@ -918,6 +965,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetAvatarOnSitTarget(LLUUID avatarID)
{
m_SitTargetAvatar = avatarID;
+ TriggerScriptChangedEvent(Changed.LINK);
}
public LLUUID GetAvatarOnSitTarget()
@@ -1328,6 +1376,7 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateTextureEntry(byte[] textureEntry)
{
m_shape.TextureEntry = textureEntry;
+ TriggerScriptChangedEvent(Changed.TEXTURE);
ScheduleFullUpdate();
}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index 0a8f7eaf2b..a32a132569 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -68,10 +68,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
+ myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
// TODO: HOOK ALL EVENTS UP TO SERVER!
}
}
+ public void changed(uint localID, uint change)
+ {
+ // Add to queue for all scripts in localID, Object pass change.
+ myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID,"changed", new object[] {(int) change});
+ }
+
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object