From 59cd0a2419266f190375074e2bede0d9a10de370 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 23:32:12 +0200 Subject: Change order of operations on backup to ensure keyframe motions are backed up properly --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 96eeec4..1734ab7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2039,8 +2039,6 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChangedDueToDelink = false; m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); - datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); - backup_group.ForEachPart(delegate(SceneObjectPart part) { if (part.KeyframeMotion != null) @@ -2048,6 +2046,12 @@ namespace OpenSim.Region.Framework.Scenes part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); part.KeyframeMotion.UpdateSceneObject(this); } + }); + + datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); + + backup_group.ForEachPart(delegate(SceneObjectPart part) + { part.Inventory.ProcessInventoryBackup(datastore); }); -- cgit v1.1 From ea91a36483f3eba90e16b664715d152f9eca2980 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 23:33:13 +0200 Subject: Add instrumentation to log finalizer being called. Suppressed for backup interim copies to avoid spammage. Not for release to the grid, must be reverted first! --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1734ab7..1730723 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2045,6 +2045,7 @@ namespace OpenSim.Region.Framework.Scenes { part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); part.KeyframeMotion.UpdateSceneObject(this); + part.SuppressFinalizerLogging = true; } }); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 16a8588..4d43943 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -149,6 +149,8 @@ namespace OpenSim.Region.Framework.Scenes #region Fields + public bool SuppressFinalizerLogging = false; + public bool AllowedDrop; public bool DIE_AT_EDGE; @@ -350,15 +352,18 @@ namespace OpenSim.Region.Framework.Scenes #endregion Fields -// ~SceneObjectPart() -// { + ~SceneObjectPart() + { + if (SuppressFinalizerLogging) + return; + // Console.WriteLine( // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", -// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); -// } + m_log.DebugFormat( + "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", + Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); + } #region Constructors -- cgit v1.1 From d9b0b03aa3f92bcd860e4edb656cf6b1221776a6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 23:54:45 +0200 Subject: Place instrumentation in the proper place. This needs reverting, too! --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1730723..efeb551 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2045,8 +2045,8 @@ namespace OpenSim.Region.Framework.Scenes { part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); part.KeyframeMotion.UpdateSceneObject(this); - part.SuppressFinalizerLogging = true; } + part.SuppressFinalizerLogging = true; }); datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); -- cgit v1.1 From c66367e6194f22da86a3bf972ec107212e732d80 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jul 2012 00:16:19 +0200 Subject: Add "gc collect" console command for debugging memleaks --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6a120c1..48aca98 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -831,6 +831,8 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; + + MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); } /// @@ -5637,5 +5639,10 @@ Environment.Exit(1); } } } + + private void HandleGcCollect(string module, string[] args) + { + GC.Collect(); + } } } -- cgit v1.1 From bae35ad97e10df4cfd3ecb73fab84081d85ede20 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jul 2012 01:01:29 +0200 Subject: Revert "Place instrumentation in the proper place. This needs reverting, too!" This reverts commit d9b0b03aa3f92bcd860e4edb656cf6b1221776a6. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index efeb551..1730723 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2045,8 +2045,8 @@ namespace OpenSim.Region.Framework.Scenes { part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); part.KeyframeMotion.UpdateSceneObject(this); + part.SuppressFinalizerLogging = true; } - part.SuppressFinalizerLogging = true; }); datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); -- cgit v1.1 From 906ac4adc4adc8eef84a584b73323fda25127806 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jul 2012 01:01:43 +0200 Subject: Revert "Add instrumentation to log finalizer being called. Suppressed for backup" This reverts commit ea91a36483f3eba90e16b664715d152f9eca2980. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 - OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1730723..1734ab7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2045,7 +2045,6 @@ namespace OpenSim.Region.Framework.Scenes { part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); part.KeyframeMotion.UpdateSceneObject(this); - part.SuppressFinalizerLogging = true; } }); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4d43943..16a8588 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -149,8 +149,6 @@ namespace OpenSim.Region.Framework.Scenes #region Fields - public bool SuppressFinalizerLogging = false; - public bool AllowedDrop; public bool DIE_AT_EDGE; @@ -352,18 +350,15 @@ namespace OpenSim.Region.Framework.Scenes #endregion Fields - ~SceneObjectPart() - { - if (SuppressFinalizerLogging) - return; - +// ~SceneObjectPart() +// { // Console.WriteLine( // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); - m_log.DebugFormat( - "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", - Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); - } +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", +// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); +// } #region Constructors -- cgit v1.1 From 4c2523b1c2dd518cc21baf7674775fa2e11e1ca9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 12 Jul 2012 20:05:00 +0100 Subject: Use faster any contact point collision detection for Volumedetect, plus some clean up --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 123 +++++------------------ OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs | 2 + OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 14 ++- 3 files changed, 41 insertions(+), 98 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index ff17a6e..8d5f269 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -134,7 +134,7 @@ namespace OpenSim.Region.Physics.OdePlugin // private bool m_collidesLand = true; private bool m_collidesWater; - public bool m_returnCollisions; +// public bool m_returnCollisions; private bool m_NoColide; // for now only for internal use for bad meshs @@ -164,8 +164,8 @@ namespace OpenSim.Region.Physics.OdePlugin private List childrenPrim = new List(); - private bool m_throttleUpdates; - private int throttleCounter; +// private bool m_throttleUpdates; +// private int throttleCounter; public float m_collisionscore; int m_colliderfilter = 0; @@ -363,12 +363,14 @@ namespace OpenSim.Region.Physics.OdePlugin set { return; } } - public override bool ThrottleUpdates + + public override bool ThrottleUpdates {get;set;} +/* { get { return m_throttleUpdates; } set { m_throttleUpdates = value; } } - +*/ public override bool Stopped { get { return _zeroFlag; } @@ -951,7 +953,8 @@ namespace OpenSim.Region.Physics.OdePlugin { if (CollisionEventsThisFrame == null) CollisionEventsThisFrame = new CollisionEventUpdate(); - CollisionEventsThisFrame.AddCollider(CollidedWith, contact); +// if(CollisionEventsThisFrame.Count < 32) + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } public void SendCollisions() @@ -977,6 +980,10 @@ namespace OpenSim.Region.Physics.OdePlugin } else { + if (ncolisions > 10) + { + } + SentEmptyCollisionsEvent = false; CollisionEventsThisFrame.Clear(); } @@ -1746,8 +1753,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (childrenPrim.Count == 0) { collide_geom = prim_geom; - m_targetSpace = _parent_scene.ActiveSpace; - d.SpaceAdd(m_targetSpace, prim_geom); + m_targetSpace = _parent_scene.ActiveSpace; } else { @@ -1755,7 +1761,6 @@ namespace OpenSim.Region.Physics.OdePlugin d.HashSpaceSetLevels(m_targetSpace, -2, 8); d.SpaceSetSublevel(m_targetSpace, 3); d.SpaceSetCleanup(m_targetSpace, false); - d.SpaceAdd(m_targetSpace, prim_geom); d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | @@ -1766,12 +1771,21 @@ namespace OpenSim.Region.Physics.OdePlugin collide_geom = m_targetSpace; } + d.SpaceAdd(m_targetSpace, prim_geom); + if (m_delaySelect) { m_isSelected = true; m_delaySelect = false; } + m_collisionscore = 0; + + UpdateCollisionCatFlags(); + ApplyCollisionCatFlags(); + + _parent_scene.addActivePrim(this); + lock (childrenPrim) { foreach (OdePrim prm in childrenPrim) @@ -1809,10 +1823,6 @@ namespace OpenSim.Region.Physics.OdePlugin createAMotor(m_angularlock); } - m_collisionscore = 0; - - UpdateCollisionCatFlags(); - ApplyCollisionCatFlags(); if (m_isSelected || m_disabled) { @@ -1824,7 +1834,6 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); } - _parent_scene.addActivePrim(this); _parent_scene.addActiveGroups(this); } @@ -3441,92 +3450,14 @@ namespace OpenSim.Region.Physics.OdePlugin if (++bodydisablecontrol < 20) return; - bodydisablecontrol = 0; + d.BodyEnable(Body); } - d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator - -/* moved down to UpdateMove... where it belongs again - - // check outside region - - if (lpos.Z < -100 || lpos.Z > 100000f) - { - m_outbounds = true; - - lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); - _acceleration.X = 0; - _acceleration.Y = 0; - _acceleration.Z = 0; - - _velocity.X = 0; - _velocity.Y = 0; - _velocity.Z = 0; - m_rotationalVelocity.X = 0; - m_rotationalVelocity.Y = 0; - m_rotationalVelocity.Z = 0; - - d.BodySetLinearVel(Body, 0, 0, 0); // stop it - d.BodySetAngularVel(Body, 0, 0, 0); // stop it - d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere - m_lastposition = _position; - m_lastorientation = _orientation; - - base.RequestPhysicsterseUpdate(); - - throttleCounter = 0; - _zeroFlag = true; - - disableBodySoft(); // disable it and colisions - base.RaiseOutOfBounds(_position); - return; - } - - if (lpos.X < 0f) - { - _position.X = Util.Clip(lpos.X, -2f, -0.1f); - m_outbounds = true; - } - else if (lpos.X > _parent_scene.WorldExtents.X) - { - _position.X = Util.Clip(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f); - m_outbounds = true; - } - if (lpos.Y < 0f) - { - _position.Y = Util.Clip(lpos.Y, -2f, -0.1f); - m_outbounds = true; - } - else if (lpos.Y > _parent_scene.WorldExtents.Y) - { - _position.Y = Util.Clip(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f); - m_outbounds = true; - } + bodydisablecontrol = 0; - if (m_outbounds) - { - m_lastposition = _position; - m_lastorientation = _orientation; - - d.Vector3 dtmp = d.BodyGetAngularVel(Body); - m_rotationalVelocity.X = dtmp.X; - m_rotationalVelocity.Y = dtmp.Y; - m_rotationalVelocity.Z = dtmp.Z; - - dtmp = d.BodyGetLinearVel(Body); - _velocity.X = dtmp.X; - _velocity.Y = dtmp.Y; - _velocity.Z = dtmp.Z; + d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator - d.BodySetLinearVel(Body, 0, 0, 0); // stop it - d.BodySetAngularVel(Body, 0, 0, 0); - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - disableBodySoft(); // stop collisions - base.RequestPhysicsterseUpdate(); - return; - } -*/ if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) { // 'VEHICLES' are dealt with in ODEDynamics.cs @@ -3721,7 +3652,7 @@ namespace OpenSim.Region.Physics.OdePlugin base.RequestPhysicsterseUpdate(); - throttleCounter = 0; +// throttleCounter = 0; _zeroFlag = true; disableBodySoft(); // disable it and colisions diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs index 2341186..ee48db5 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs @@ -61,6 +61,8 @@ namespace OdeAPI public static int NTotalBodies = 0; public static int NTotalGeoms = 0; + public const uint CONTACTS_UNIMPORTANT = 0x80000000; + #region Flags and Enumerations [Flags] diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 7848b35..088d2ba 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -713,8 +713,18 @@ namespace OpenSim.Region.Physics.OdePlugin if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) return; - - count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); + if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || + d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc) + { + int cflags; + unchecked + { + cflags = (int)(1 | d.CONTACTS_UNIMPORTANT); + } + count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); + } + else + count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); } catch (SEHException) { -- cgit v1.1 From 4e97237460028281871d989a1fb833706366301c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 13 Jul 2012 00:01:01 +0200 Subject: Revert " lltargetomega efective spinrate now multiplied by gain ( need check )" Undo figuring gain into spinrate in llTargetOmega. In SL, gain has null effect on nonphysical spinning objects. This reverts commit df55de5b3d88e241f35217d5c08d02b921991513. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ca62bac..d2dab6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3822,7 +3822,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) { - spinrate *= gain; part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); } -- cgit v1.1 From 5cfea5934ba2aa19bc864c950c60a4c29f017316 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 13 Jul 2012 19:32:43 +0100 Subject: fix bad vehicle reference frame --- OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs index e900c02..a7dda7a 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs @@ -425,7 +425,8 @@ namespace OpenSim.Region.Physics.OdePlugin switch (pParam) { case Vehicle.REFERENCE_FRAME: - m_referenceFrame = Quaternion.Inverse(pValue); + // m_referenceFrame = Quaternion.Inverse(pValue); + m_referenceFrame = pValue; break; case Vehicle.ROLL_FRAME: m_RollreferenceFrame = pValue; -- cgit v1.1 From 39262f6232978f63ce997288052b4bfab433a2f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 13 Jul 2012 20:25:47 +0100 Subject: missed fix on vehicle reference frame --- OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 41e8944..9cb901a 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs @@ -36,7 +36,6 @@ using System.Xml; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.Framework.Scenes { @@ -215,7 +214,7 @@ namespace OpenSim.Region.Framework.Scenes switch (pParam) { case Vehicle.REFERENCE_FRAME: - vd.m_referenceFrame = Quaternion.Inverse(pValue); + vd.m_referenceFrame = pValue; break; } }//end ProcessRotationVehicleParam -- cgit v1.1 From 72e2b9409462861d183ac7b391f5911defcd3bb0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 13 Jul 2012 23:57:45 +0100 Subject: In collisions report linksets root parts to parts, and not all parts. Temporary suspend collision checks on full stopped bodies, until a better away is found wake them, avoiding spurius collision end and start events. Until a nice way is found to avoid them, this may cause some higher cpu load. plus some clean up --- .../Region/Physics/UbitOdePlugin/ODECharacter.cs | 3 +- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 39 ++++++++++----------- .../UbitOdePlugin/ODERayCastRequestManager.cs | 4 +-- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 40 +++++++++++++--------- 4 files changed, 45 insertions(+), 41 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 865180f..b506b1c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_iscollidingObj = false; private bool m_alwaysRun = false; private int m_requestedUpdateFrequency = 0; - public uint m_localID = 0; + private uint m_localID = 0; public bool m_returnCollisions = false; // taints and their non-tainted counterparts public bool m_isPhysical = false; // the current physical status @@ -214,6 +214,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override uint LocalID { + get { return m_localID; } set { m_localID = value; } } diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 8d5f269..6d322e2 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -101,7 +101,6 @@ namespace OpenSim.Region.Physics.OdePlugin private float m_invTimeStep = 50.0f; private float m_timeStep = .02f; - private Vector3 m_PIDTarget; private float m_PIDTau; private bool m_usePID; @@ -119,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. private int body_autodisable_frames = 5; - private int bodydisablecontrol = 0; + public int bodydisablecontrol = 0; // Default we're a Geometry @@ -144,7 +143,7 @@ namespace OpenSim.Region.Physics.OdePlugin public bool m_disabled; - public uint m_localID; + private uint m_localID; private IMesh m_mesh; private object m_meshlock = new object(); @@ -167,7 +166,7 @@ namespace OpenSim.Region.Physics.OdePlugin // private bool m_throttleUpdates; // private int throttleCounter; public float m_collisionscore; - int m_colliderfilter = 0; + private int m_colliderfilter = 0; public IntPtr collide_geom; // for objects: geom if single prim space it linkset @@ -235,7 +234,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override bool Phantom // this is not reliable for internal use { get { return m_fakeisphantom; } @@ -293,14 +291,18 @@ namespace OpenSim.Region.Physics.OdePlugin public override uint LocalID { + get { return m_localID; } + set { m_localID = value; } + } + + public OdePrim Parent + { get { - return m_localID; - } - set - { - //m_log.Info("[PHYSICS]: Setting TrackerID: " + value); - m_localID = value; + if (childPrim) + return (OdePrim)_parent; + else + return this; } } @@ -945,8 +947,7 @@ namespace OpenSim.Region.Physics.OdePlugin CollisionEventsThisFrame = null; } m_eventsubscription = 0; - // for now still done on odescene -// _parent_scene.RemoveCollisionEventReporting(this); + _parent_scene.RemoveCollisionEventReporting(this); } public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) @@ -980,10 +981,6 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - if (ncolisions > 10) - { - } - SentEmptyCollisionsEvent = false; CollisionEventsThisFrame.Clear(); } @@ -1832,8 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin { d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); - } - + } _parent_scene.addActiveGroups(this); } @@ -3700,6 +3696,8 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodySetAngularVel(Body, 0, 0, 0); d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); disableBodySoft(); // stop collisions + UnSubscribeEvents(); + base.RequestPhysicsterseUpdate(); return; } @@ -3871,8 +3869,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_vehicle = null; RemoveGeom(); m_targetSpace = IntPtr.Zero; - if (m_eventsubscription > 0) - UnSubscribeEvents(); + UnSubscribeEvents(); return true; case changes.Link: diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 5122ebf..3d108f8 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs @@ -509,14 +509,14 @@ namespace OpenSim.Region.Physics.OdePlugin if ((thisFlags & CurrentRayFilter) == 0) return; - ID = ((OdePrim)p2).m_localID; + ID = ((OdePrim)p2).LocalID; } else if (p2 is OdeCharacter) { if ((CurrentRayFilter & RayFilterFlags.agent) == 0) return; else - ID = ((OdeCharacter)p2).m_localID; + ID = ((OdeCharacter)p2).LocalID; } else //?? return; diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 088d2ba..659180d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1171,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin OdePrim cp1; OdeCharacter cc2; OdePrim cp2; + OdePrim cp1Parent; + OdePrim cp2Parent; uint obj2LocalID = 0; bool p1events = p1.SubscribedEvents(); @@ -1207,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin { case ActorTypes.Agent: cc2 = (OdeCharacter)p2; - obj2LocalID = cc2.m_localID; + obj2LocalID = cc2.LocalID; if (p2events) - cc2.AddCollisionEvent(cc1.m_localID, contact); + cc2.AddCollisionEvent(cc1.LocalID, contact); break; case ActorTypes.Prim: if (p2 is OdePrim) { cp2 = (OdePrim)p2; - obj2LocalID = cp2.m_localID; if (p2events) - cp2.AddCollisionEvent(cc1.m_localID, contact); + cp2.AddCollisionEvent(cc1.LocalID, contact); + cp2 = cp2.Parent; + obj2LocalID = cp2.LocalID; } break; @@ -1240,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin if (p1 is OdePrim) { cp1 = (OdePrim)p1; - - // obj1LocalID = cp2.m_localID; + cp1Parent = cp1.Parent; switch ((ActorTypes)p2.PhysicsActorType) { case ActorTypes.Agent: if (p2 is OdeCharacter) { cc2 = (OdeCharacter)p2; - obj2LocalID = cc2.m_localID; + obj2LocalID = cc2.LocalID; if (p2events) - cc2.AddCollisionEvent(cp1.m_localID, contact); + cc2.AddCollisionEvent(cp1Parent.LocalID, contact); } break; case ActorTypes.Prim: @@ -1258,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin if (p2 is OdePrim) { cp2 = (OdePrim)p2; - obj2LocalID = cp2.m_localID; if (p2events) - cp2.AddCollisionEvent(cp1.m_localID, contact); + cp2.AddCollisionEvent(cp1Parent.LocalID, contact); + cp2 = cp2.Parent; + obj2LocalID = cp2.LocalID; } break; @@ -1286,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (p2 is OdeCharacter) { cc2 = (OdeCharacter)p2; - obj2LocalID = cc2.m_localID; + obj2LocalID = cc2.LocalID; if (p2events) cc2.AddCollisionEvent(0, contact); } @@ -1295,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (p2 is OdePrim) { cp2 = (OdePrim)p2; - obj2LocalID = cp2.m_localID; + obj2LocalID = cp2.LocalID; if (p2events) cp2.AddCollisionEvent(0, contact); } @@ -1350,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin { foreach (OdePrim prm in _activegroups) { - if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) - d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); + if (!prm.m_outbounds) + { +// if (d.BodyIsEnabled(prm.Body)) + d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); + } } } catch (AccessViolationException) @@ -1604,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); lock (prim) { - RemoveCollisionEventReporting(prim); +// RemoveCollisionEventReporting(prim); lock (_prims) _prims.Remove(prim); } @@ -2012,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin case ActorTypes.Prim: OdePrim pobj = (OdePrim)obj; if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) + if (!pobj.m_outbounds) { pobj.AddCollisionFrameTime((int)(odetimestepMS)); pobj.SendCollisions(); @@ -2728,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin WaterMapHandler.Free(); } - if (ContactgeomsArray != IntPtr.Zero) Marshal.FreeHGlobal(ContactgeomsArray); if (GlobalContactsArray != IntPtr.Zero) @@ -2751,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin { if (prm.CollisionScore > 0) { - returncolliders.Add(prm.m_localID, prm.CollisionScore); + returncolliders.Add(prm.LocalID, prm.CollisionScore); cnt++; prm.CollisionScore = 0f; if (cnt > 25) -- cgit v1.1 From 95f2d8654989807c1bc4fe39cd8715210ac1a9ae Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 14 Jul 2012 09:13:27 +0200 Subject: Reinstate sleeping because less CPU is preferred over reporting accuracy. Who needs accurate collisions when the sim lags and crashes? --- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 659180d..2928257 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1355,7 +1355,7 @@ namespace OpenSim.Region.Physics.OdePlugin { if (!prm.m_outbounds) { -// if (d.BodyIsEnabled(prm.Body)) + if (d.BodyIsEnabled(prm.Body)) d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); } } -- cgit v1.1 From caef55a6366477b093afd92dadff2c42528a4bc7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 01:05:04 +0200 Subject: Set up https to work like http does in the poll handler --- OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9c5596b..c0c97c9 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -214,9 +214,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp string uri = "/lslhttps/" + urlcode.ToString() + "/"; - m_HttpsServer.AddPollServiceHTTPHandler( - uri, - new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode,25000)); + PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000)); + args.Type = PollServiceEventArgs.EventType.LslHttp; + m_HttpsServer.AddPollServiceHTTPHandler(uri, args); engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); } -- cgit v1.1 From 6f7b5ef4cb7a7ba5a780fbb602b82d01347957ab Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 02:24:01 +0200 Subject: Fix a double parenthesis typo --- OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index c0c97c9..6579f07 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -214,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp string uri = "/lslhttps/" + urlcode.ToString() + "/"; - PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000)); + PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000); args.Type = PollServiceEventArgs.EventType.LslHttp; m_HttpsServer.AddPollServiceHTTPHandler(uri, args); -- cgit v1.1 From 07b7301c22be2a89de56b5c13a5e30799106ae21 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 11:21:01 +0200 Subject: Make https work in the poll service manager --- OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 6579f07..dcf49a7 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -199,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); return urlcode; } - string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; + string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); UrlData urlData = new UrlData(); urlData.hostID = host.UUID; @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp m_UrlMap[url] = urlData; - string uri = "/lslhttps/" + urlcode.ToString() + "/"; + string uri = "/lslhttps/" + urlcode.ToString(); PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000); args.Type = PollServiceEventArgs.EventType.LslHttp; -- cgit v1.1 From e3fa73da96f5612da52d140425f1633494d6edef Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 17:17:59 +0200 Subject: Experimentally handle UseCircuitCode synchrnonously --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..56c0992 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,7 +701,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + //Util.FireAndForget(HandleUseCircuitCode, array); + HandleUseCircuitCode(array); return; } -- cgit v1.1 From 8b4f7604e618ed409cd4dcb44dcf14ce22b72be7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 19:45:08 +0200 Subject: Revert "Experimentally handle UseCircuitCode synchrnonously" This reverts commit e3fa73da96f5612da52d140425f1633494d6edef. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 56c0992..bd8273d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,8 +701,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - //Util.FireAndForget(HandleUseCircuitCode, array); - HandleUseCircuitCode(array); + Util.FireAndForget(HandleUseCircuitCode, array); return; } -- cgit v1.1 From 47f7cc9457bfc5c909290ac189b34dd3eceebe7f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:41:10 +0200 Subject: Fix a sit rotation issue --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d2dab6f..952d5da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8062,7 +8062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation + rot = srot * rot; // removed sit part offset rotation av.Rotation = rot; // av.SendAvatarDataToAllAgents(); av.SendTerseUpdateToAllClients(); -- cgit v1.1 From ec40c545091c8df70eea0e79e2878b69c0a649d9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:48:32 +0200 Subject: Revert "Fix a sit rotation issue" This reverts commit 47f7cc9457bfc5c909290ac189b34dd3eceebe7f. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 952d5da..d2dab6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8062,7 +8062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Quaternion srot = sitpart.RotationOffset; - rot = srot * rot; // removed sit part offset rotation + rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation av.Rotation = rot; // av.SendAvatarDataToAllAgents(); av.SendTerseUpdateToAllClients(); -- cgit v1.1 From a2d19b97030e2249372e8635b67276ff676460aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:48:47 +0200 Subject: Replace sit position and rotation code with older, working version --- .../Shared/Api/Implementation/LSL_Api.cs | 54 +++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d2dab6f..b20ca6d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8015,31 +8015,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch (code) { - // a avatar is a child case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POS_LOCAL: { if (remain < 1) return; + LSL_Vector v; v = rules.GetVector3Item(idx++); - if (sitpart == null) + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) break; - Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position - - if (sitpart != sitpart.ParentGroup.RootPart) + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + if (llGetLinkNumber() > 1) { - pos -= sitpart.OffsetPosition; // remove sit part offset - Quaternion rot = sitpart.RotationOffset; - pos *= Quaternion.Conjugate(rot); // removed sit part rotation + localRot = llGetLocalRot(); + localPos = llGetLocalPos(); } - Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); - pos += sitOffset; - finalPos = pos; - positionChanged = true; + v -= localPos; + v /= localRot; + + LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); + + v = v + 2 * sitOffset; + + av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); + av.SendAvatarDataToAllAgents(); + } break; @@ -8048,24 +8054,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; - if (sitpart == null) - break; - - LSL_Rotation r = rules.GetQuaternionItem(idx++); - Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; -// need to replicate SL bug - SceneObjectGroup sitgrp = sitpart.ParentGroup; - if (sitgrp != null && sitgrp.RootPart != sitpart) + if (llGetLinkNumber() > 1) { - rot = sitgrp.RootPart.RotationOffset * rot; + localRot = llGetLocalRot(); + localPos = llGetLocalPos(); } - Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation - av.Rotation = rot; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + r = r * llGetRootRotation() / localRot; + av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); + av.SendAvatarDataToAllAgents(); } break; -- cgit v1.1 From 8baf4dcc786b91a427e60dca9f0d0eeb05ddae19 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:55:54 +0200 Subject: Reinstate older set rotation code for avatars since it works in all cases --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +--------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b20ca6d..5bade25 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8000,7 +8000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. int idx = 0; - SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used bool positionChanged = false; Vector3 finalPos = Vector3.Zero; @@ -8049,6 +8048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROTATION: { if (remain < 1) @@ -8071,27 +8071,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } break; - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - { - if (remain < 1) - return; - - if (sitpart == null) - break; - - LSL_Rotation r = rules.GetQuaternionItem(idx++); - Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation - if (sitpart != sitpart.ParentGroup.RootPart) - { - Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation - } - av.Rotation = rot; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); - } - break; - // parse rest doing nothing but number of parameters error check case (int)ScriptBaseClass.PRIM_SIZE: case (int)ScriptBaseClass.PRIM_MATERIAL: -- cgit v1.1 From 283df0610de50f77460f980ba15e4cbb23f5b657 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 21:45:06 +0200 Subject: Save packets received while the client is added and replay them later. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..34923be 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings private bool m_sendPing; + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + private int m_defaultRTO = 0; private int m_maxRTO = 0; @@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; + lock (m_pendingCache) + m_pendingCache.AddOrUpdate(address, new Queue(), 60); Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -710,6 +714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { + lock (m_pendingCache) + { + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) + queue.Enqueue(buffer); + } + // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -943,6 +954,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) client.SceneAgent.SendInitialDataToMe(); + + // Now we know we can handle more data + Thread.Sleep(200); + + // Obtain the queue and remove it from the cache + Queue queue = null; + + lock (m_pendingCache) + { + if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + return; + m_pendingCache.Remove(remoteEndPoint); + } + + // Reinject queued packets + while(queue.Count > 0) + { + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); + } + queue = null; } else { @@ -950,6 +982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.WarnFormat( "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); + lock (m_pendingCache) + m_pendingCache.Remove(remoteEndPoint); } // m_log.DebugFormat( -- cgit v1.1 From b130dcea21130b65a3dbe400b0c50e1f5e461972 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 22:28:47 +0200 Subject: Testing changes and instrumentation --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 34923be..c807260 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,10 +701,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) { - object[] array = new object[] { buffer, packet }; - lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } + + object[] array = new object[] { buffer, packet }; + Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -718,10 +724,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Queue queue; if (m_pendingCache.TryGetValue(address, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); + } + else + { + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + } } -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -964,10 +976,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; + } m_pendingCache.Remove(remoteEndPoint); } + m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); + // Reinject queued packets while(queue.Count > 0) { -- cgit v1.1 From 668723fab31976895ceb42a372cfff7ed5689a9d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 23:01:58 +0200 Subject: Remove instrumentation and fix the message delivery issue --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 52 ++++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c807260..46337b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -698,42 +698,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Packet to Client Mapping - // UseCircuitCode handling - if (packet.Type == PacketType.UseCircuitCode) + // If there is already a client for this endpoint, don't process UseCircuitCode + IClientAPI client = null; + if (!m_scene.TryGetClient(address, out client)) { - lock (m_pendingCache) + // UseCircuitCode handling + if (packet.Type == PacketType.UseCircuitCode) { - if (m_pendingCache.Contains(address)) - return; + // And if there is a UseCircuitCode pending, also drop it + lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; - m_pendingCache.AddOrUpdate(address, new Queue(), 60); - } + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } - object[] array = new object[] { buffer, packet }; + object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + Util.FireAndForget(HandleUseCircuitCode, array); - return; + return; + } } - // Determine which agent this packet came from - IClientAPI client; - if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) + // If this is a pending connection, enqueue, don't process yet + lock (m_pendingCache) { - lock (m_pendingCache) + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) { - Queue queue; - if (m_pendingCache.TryGetValue(address, out queue)) - { - m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); - queue.Enqueue(buffer); - } - else - { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); - } + //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); + queue.Enqueue(buffer); + return; } + } + // Determine which agent this packet came from + if (client == null || !(client is LLClientView)) + { + //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 12049e1120559a36ea5fd0453a36210808d04363 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jul 2012 11:03:12 +0200 Subject: Allow setting linked avatar positions from within a prim not the one sat on --- .../Shared/Api/Implementation/LSL_Api.cs | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5bade25..595dd8a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2470,8 +2470,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Rotation llGetLocalRot() { + return GetPartLocalRot(m_host); + } + + private LSL_Rotation GetPartLocalRot(SceneObjectPart part) + { m_host.AddScriptLPS(1); - Quaternion rot = m_host.RotationOffset; + Quaternion rot = part.RotationOffset; return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); } @@ -8029,10 +8034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) + if (part.LinkNum > 1) { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); + localRot = GetPartLocalRot(part); + localPos = GetPartLocalPos(part); } v -= localPos; @@ -8054,17 +8059,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) - { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); - } + if (part.LinkNum > 1) + localRot = GetPartLocalRot(part); - LSL_Rotation r; - r = rules.GetQuaternionItem(idx++); r = r * llGetRootRotation() / localRot; av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); av.SendAvatarDataToAllAgents(); -- cgit v1.1