From 38cfc9366ce264d2aeb6409df48be7cecc348952 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 25 Jan 2010 21:51:58 +0000 Subject: Fix a problem where llDie() calls were sometimes leaving dead objects behind. When an object was deleted, the remove script instance call was aggregating the scripting events as normal. This would queue a full update of the prim before the viewer was notifed of the deletion of that prim (QuitPacket) On some occasions, the QuitPacket would be sent before the full update was dequeued and sent. In principle, you would think that a viewer would ignore updates for deleted prims. But it appears that in the Linden viewer (1.23.5), a prim update that arrives after the prim was deleted instead makes the deleted prim persist in the viewer. Such prims have no properties and cannot be removed from the viewer except by a relog. This change stops the prim event aggregation call if it's being deleted anyway, hence removing the spurious viewer-confusing update. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56b2f13..a5296eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2479,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); //ScheduleFullUpdate(); } - + public void RemoveScriptEvents(UUID scriptid) { lock (m_scriptEvents) @@ -2533,6 +2533,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate() { +// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); + if (m_parentGroup != null) { m_parentGroup.QueueForUpdateCheck(); @@ -4042,6 +4044,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup == null) { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); ScheduleFullUpdate(); return; } @@ -4058,9 +4062,15 @@ namespace OpenSim.Region.Framework.Scenes LocalFlags=(PrimFlags)objectflagupdate; if (m_parentGroup != null && m_parentGroup.RootPart == this) + { m_parentGroup.aggregateScriptEvents(); + } else + { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); ScheduleFullUpdate(); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) -- cgit v1.1 From 3863cd1d2395fb87489ed4e544fc33048c81761c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 21:35:05 +0000 Subject: Copy prim face color setting code from LSL_Api down into SOP so that non-LSL callers can use it --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 192 +++++++++++++++++++++ 1 file changed, 192 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a5296eb..8b5c348 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -90,10 +90,27 @@ namespace OpenSim.Region.Framework.Scenes SCALE = 0x40 } + public enum PrimType : int + { + BOX = 0, + CYLINDER = 1, + PRISM = 2, + SPHERE = 3, + TORUS = 4, + TUBE = 5, + RING = 6, + SCULPT = 7 + } + #endregion Enumerations public class SceneObjectPart : IScriptHost { + /// + /// Denote all sides of the prim + /// + public const int ALL_SIDES = -1; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // use only one serializer to give the runtime a chance to optimize it (it won't do that if you @@ -737,6 +754,9 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Text color. + /// public Color Color { get { return m_color; } @@ -2955,6 +2975,178 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the color of prim faces + /// + /// + /// + public void SetFaceColor(Vector3 color, int face) + { + Primitive.TextureEntry tex = Shape.Textures; + Color4 texcolor; + if (face >= 0 && face < GetNumberOfSides()) + { + texcolor = tex.CreateFace((uint)face).RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[face].RGBA = texcolor; + UpdateTexture(tex); + return; + } + else if (face == ALL_SIDES) + { + for (uint i = 0; i < GetNumberOfSides(); i++) + { + if (tex.FaceTextures[i] != null) + { + texcolor = tex.FaceTextures[i].RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[i].RGBA = texcolor; + } + texcolor = tex.DefaultTexture.RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + UpdateTexture(tex); + return; + } + } + + /// + /// Get the number of sides that this part has. + /// + /// + public int GetNumberOfSides() + { + int ret = 0; + bool hasCut; + bool hasHollow; + bool hasDimple; + bool hasProfileCut; + + PrimType primType = getScriptPrimType(); + hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + + switch (primType) + { + case PrimType.BOX: + ret = 6; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.CYLINDER: + ret = 3; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.PRISM: + ret = 5; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SPHERE: + ret = 1; + if (hasCut) ret += 2; + if (hasDimple) ret += 2; + if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + break; + case PrimType.TORUS: + ret = 1; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.TUBE: + ret = 4; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.RING: + ret = 3; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SCULPT: + ret = 1; + break; + } + return ret; + } + + /// + /// Tell us what type this prim is + /// + /// + /// + public PrimType getScriptPrimType() + { + if (Shape.SculptEntry) + return PrimType.SCULPT; + if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.BOX; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TUBE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.CYLINDER; + // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TORUS; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) + { + if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) + return PrimType.SPHERE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.PRISM; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.RING; + } + + return PrimType.BOX; + } + + /// + /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces + /// + /// + /// + /// + /// + /// + /// + protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + out bool hasDimple, out bool hasProfileCut) + { + if (primType == PrimType.BOX + || + primType == PrimType.CYLINDER + || + primType == PrimType.PRISM) + + hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); + else + hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); + + hasHollow = shape.ProfileHollow > 0; + hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms + hasProfileCut = hasDimple; // is it the same thing? + } + public void SetGroup(UUID groupID, IClientAPI client) { _groupID = groupID; -- cgit v1.1 From ecc068fbe0b8a95563281c3aaf8e7392e5ef49e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:08:00 +0000 Subject: remove now duplicated shape code from LSL_Api.cs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8b5c348..33c3fcf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,8 +3029,8 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = getScriptPrimType(); - hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + PrimType primType = GetScriptPrimType(); + HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) { @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType getScriptPrimType() + public PrimType GetScriptPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; @@ -3129,7 +3129,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, out bool hasDimple, out bool hasProfileCut) { if (primType == PrimType.BOX -- cgit v1.1 From 5432925a3b153737adf7f59483e05202068ce2af Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:29:21 +0000 Subject: move hollow sphere faces bug back up to LSL_Api.cs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 33c3fcf..4f9beb7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3053,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes ret = 1; if (hasCut) ret += 2; if (hasDimple) ret += 2; - if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + if (hasHollow) ret += 1; break; case PrimType.TORUS: ret = 1; -- cgit v1.1 From 08721be3740624fb10a205bcf1ddcfd58bff7f87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:33:15 +0000 Subject: minor: rename GetScriptPrimType() to GetPrimType() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4f9beb7..ef9005f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,7 +3029,7 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = GetScriptPrimType(); + PrimType primType = GetPrimType(); HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType GetScriptPrimType() + public PrimType GetPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; -- cgit v1.1 From dc8240910620b1ca2faa0709c0db00d405124193 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Feb 2010 19:04:06 +0000 Subject: minor: add method doc to sop.SetScriptEvents() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005f..d7f9bbb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3178,6 +3178,11 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the events that this part will pass on to listeners. + /// + /// + /// public void SetScriptEvents(UUID scriptid, int events) { // scriptEvents oldparts; -- cgit v1.1 From 88d0fc3b093e1ae79ef17e2496348251e196a5fa Mon Sep 17 00:00:00 2001 From: radams1 Date: Tue, 2 Feb 2010 16:20:02 -0800 Subject: allow terrain collision events after regular collision check Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005f..b1c6fb9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1921,7 +1921,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in startedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; @@ -2057,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes { // always running this check because if the user deletes the object it would return a null reference. if (localId == 0) - return; + continue; if (m_parentGroup == null) return; @@ -2189,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in endedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) -- cgit v1.1 From daa66c4811be49a0eee843f2bc77a3465da674de Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 16:40:21 +0000 Subject: add an IsRoot property to sop --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d7f9bbb..d012d3e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -113,6 +113,15 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Is this sop a root part? + /// + [XmlIgnore] + public bool IsRoot + { + get { return ParentGroup.RootPart == this; } + } + // use only one serializer to give the runtime a chance to optimize it (it won't do that if you // use a new instance every time) private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); -- cgit v1.1 From f1b99c4a7f9543c3a2aa36de2e659bdefca9e68b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Feb 2010 21:35:56 +0000 Subject: minor: one method doc --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8d84557..dd797fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4144,9 +4144,13 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } - // Added to handle bug in libsecondlife's TextureEntry.ToBytes() - // not handling RGBA properly. Cycles through, and "fixes" the color - // info + /// + /// Update the textures on the part. + /// + /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() + /// not handling RGBA properly. Cycles through, and "fixes" the color + /// info + /// public void UpdateTexture(Primitive.TextureEntry tex) { //Color4 tmpcolor; -- cgit v1.1