From 0a81038dd5be361dba0a95546f3ef695ae720fc6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 10 Aug 2010 17:26:31 +0100 Subject: Reduce number of paths in SOP code by setting flags via Flags property rather than _flags Both ObjectFlags and Flags are effectively exactly the same property, except that ObjectFlags is uint and Flags is PrimFlags Both reference the PrimFlags _flags underneath, so you couldn't set a non PrimFlags uint anyway. Deprecated ObjectFlags in favour of Flags. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 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 0c35eec..0d3f64c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -396,7 +396,7 @@ namespace OpenSim.Region.Framework.Scenes // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log - _flags = 0; + Flags = 0; CreateSelected = true; TrimPermissions(); @@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes private uint _groupMask = (uint)PermissionMask.None; private uint _everyoneMask = (uint)PermissionMask.None; private uint _nextOwnerMask = (uint)PermissionMask.All; - private PrimFlags _flags = 0; + private PrimFlags _flags = PrimFlags.None; private DateTime m_expires; private DateTime m_rezzed; private bool m_createSelected = false; @@ -471,10 +471,14 @@ namespace OpenSim.Region.Framework.Scenes set { m_inventory.Items = value; } } + /// + /// This is idential to the Flags property, except that the returned value is uint rather than PrimFlags + /// + [Obsolete("Use Flags property instead")] public uint ObjectFlags { - get { return (uint)_flags; } - set { _flags = (PrimFlags)value; } + get { return (uint)Flags; } + set { Flags = (PrimFlags)value; } } public UUID UUID @@ -1169,7 +1173,11 @@ namespace OpenSim.Region.Framework.Scenes public PrimFlags Flags { get { return _flags; } - set { _flags = value; } + set + { +// m_log.DebugFormat("[SOP]: Setting flags for {0} {1} to {2}", UUID, Name, value); + _flags = value; + } } [XmlIgnore] @@ -1305,7 +1313,7 @@ namespace OpenSim.Region.Framework.Scenes if ((ObjectFlags & (uint) flag) == 0) { //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); - _flags |= flag; + Flags |= flag; if (flag == PrimFlags.TemporaryOnRez) ResetExpire(); @@ -1940,12 +1948,14 @@ namespace OpenSim.Region.Framework.Scenes } public uint GetEffectiveObjectFlags() - { - PrimFlags f = _flags; - if (m_parentGroup == null || m_parentGroup.RootPart == this) - f &= ~(PrimFlags.Touch | PrimFlags.Money); + { + // Commenting this section of code out since it doesn't actually do anything, as enums are handled by + // value rather than reference +// PrimFlags f = _flags; +// if (m_parentGroup == null || m_parentGroup.RootPart == this) +// f &= ~(PrimFlags.Touch | PrimFlags.Money); - return (uint)_flags | (uint)LocalFlags; + return (uint)Flags | (uint)LocalFlags; } public Vector3 GetGeometricCenter() @@ -2696,10 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes public void RemFlag(PrimFlags flag) { // PrimFlags prevflag = Flags; - if ((ObjectFlags & (uint) flag) != 0) + if ((Flags & flag) != 0) { //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString()); - _flags &= ~flag; + Flags &= ~flag; } //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); //ScheduleFullUpdate(); @@ -2990,10 +3000,10 @@ namespace OpenSim.Region.Framework.Scenes if (remoteClient.AgentId == _ownerID) { - if ((uint) (_flags & PrimFlags.CreateSelected) != 0) + if ((Flags & PrimFlags.CreateSelected) != 0) { clientFlags |= (uint) PrimFlags.CreateSelected; - _flags &= ~PrimFlags.CreateSelected; + Flags &= ~PrimFlags.CreateSelected; } } //bool isattachment = IsAttachment; -- cgit v1.1 From 2a1c11fda9b4ab948b7821ef2423270793a5e577 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 10 Aug 2010 20:15:44 +0100 Subject: On shift-copy of an object, set up a new physics actor (as appropriate) for every copied prim, not just the root This addresses http://opensimulator.org/mantis/view.php?id=4295 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 ++++++++++++++++++---- 1 file changed, 18 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 0d3f64c..cf718cb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -150,8 +150,17 @@ namespace OpenSim.Region.Framework.Scenes // TODO: This needs to be persisted in next XML version update! [XmlIgnore] public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; + [XmlIgnore] - public PhysicsActor PhysActor; + public PhysicsActor PhysActor + { + get { return m_physActor; } + set + { +// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID); + m_physActor = value; + } + } //Xantor 20080528 Sound stuff: // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. @@ -297,6 +306,7 @@ namespace OpenSim.Region.Framework.Scenes /// private byte m_updateFlag; + private PhysicsActor m_physActor; protected Vector3 m_acceleration; protected Vector3 m_angularVelocity; @@ -1006,7 +1016,11 @@ namespace OpenSim.Region.Framework.Scenes public bool CreateSelected { get { return m_createSelected; } - set { m_createSelected = value; } + set + { +// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); + m_createSelected = value; + } } #endregion @@ -1531,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_log.DebugFormat("[SPEW]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); + m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); } } } @@ -1801,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes /// that's not wholesome. Had to make Scene public //PhysActor = null; - if ((ObjectFlags & (uint)PrimFlags.Phantom) == 0) + if ((Flags & PrimFlags.Phantom) == 0) { if (UsePhysics) { -- cgit v1.1 From 4f62f00ca01045ec55987cd7c98410c77db03dfd Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 9 Aug 2010 23:46:30 +0200 Subject: Changing prim color generates event CHANGED_COLOR. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 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 cf718cb..74b10c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3313,6 +3313,7 @@ namespace OpenSim.Region.Framework.Scenes texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.FaceTextures[face].RGBA = texcolor; UpdateTexture(tex); + TriggerScriptChangedEvent(Changed.COLOR); return; } else if (face == ALL_SIDES) @@ -3334,6 +3335,7 @@ namespace OpenSim.Region.Framework.Scenes tex.DefaultTexture.RGBA = texcolor; } UpdateTexture(tex); + TriggerScriptChangedEvent(Changed.COLOR); return; } } -- cgit v1.1 From d98d5ee6be233cf644be5ee1011c4a7f4b86ae46 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 10 Aug 2010 19:42:18 +0100 Subject: Remove windows line endinge --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 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 77581af..277384e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -718,20 +718,20 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); - } - - if (!m_parentGroup.m_dupeInProgress) - { - List avs = ParentGroup.GetLinkedAvatars(); - foreach (ScenePresence av in avs) - { - if (av.LinkedPrim == m_uuid) - { - Vector3 offset = (m_offsetPosition - oldpos); - av.OffsetPosition += offset; - av.SendFullUpdateToAllClients(); - } - } + } + + if (!m_parentGroup.m_dupeInProgress) + { + List avs = ParentGroup.GetLinkedAvatars(); + foreach (ScenePresence av in avs) + { + if (av.LinkedPrim == m_uuid) + { + Vector3 offset = (m_offsetPosition - oldpos); + av.OffsetPosition += offset; + av.SendFullUpdateToAllClients(); + } + } } } TriggerScriptChangedEvent(Changed.POSITION); -- cgit v1.1