From 482c7b5368faa034b73b3434fd90ce3702644cb8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 18 Jan 2013 11:37:36 -0800 Subject: [PATCH 1/8] BulletSim: add logic to turn off pre-step actions when object goes non-active. This turns off 'setForce', 'setTorque' and 'moveToTarget' when the object is selected or made non-physical. --- .../Region/Physics/BulletSPlugin/BSPrim.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 7aa2d92ca6..aaa6fe580d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -502,6 +502,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.setForce", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.setForce", LocalID); + return; + } + DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); if (PhysBody.HasPhysicalBody) { @@ -627,6 +633,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.setTorque", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.setTorque", LocalID); + return; + } + if (PhysBody.HasPhysicalBody) AddAngularForce(_torque, false, true); } @@ -1061,6 +1073,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.PIDTarget", LocalID); + return; + } + OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) // 'movePosition' is where we'd like the prim to be at this moment. @@ -1108,6 +1126,9 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + return; + _hoverMotor.SetCurrent(RawPosition.Z); _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); float targetHeight = _hoverMotor.Step(timeStep); From c6b6c94ccbbbd5226a377a510a988bedec7a418c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 18 Jan 2013 11:39:24 -0800 Subject: [PATCH 2/8] BulletSim: reduce jitter in avatar velocity when walking or flying. OpenSimulator is VERY sensitive to changes in avatar velocity and will send an avatar update message when velocity changes more than 0.001m/s. This significantly reduces the number of avatar update messages by smoothing the avatar velocity returned by Bullet. --- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 9 ++++++++- OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 6d5e23f7d9..478aeab799 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -853,7 +853,14 @@ public sealed class BSCharacter : BSPhysObject { _position = entprop.Position; _orientation = entprop.Rotation; - _velocity = entprop.Velocity; + + // Smooth velocity. OpenSimulator is very sensitive to changes in velocity of the avatar + // and will send agent updates to the clients if velocity changes by more than + // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many + // extra updates. + if (!entprop.Velocity.ApproxEquals(_velocity, 0.1f)) + _velocity = entprop.Velocity; + _acceleration = entprop.Acceleration; _rotationalVelocity = entprop.RotationalVelocity; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index bac0427274..5353c756cf 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -141,7 +141,7 @@ public abstract class BSPhysObject : PhysicsActor // It can be confusing for an actor to know if it should move or update an object // depeneding on the setting of 'selected', 'physical, ... - // This flag is the true test -- if true, the object is being acted on in the physical world + // This flag is the true test -- if true, the object is being acted on in the physical world public abstract bool IsPhysicallyActive { get; } // Materialness From 74256c0cc47870f6057b64ce117479af79f02ab0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Jan 2013 22:57:09 +0000 Subject: [PATCH 3/8] Restore previous client AO behaviour by not allowing them to remove the default animation but continue to allow scripts to do so. This keeps the fix from http://opensimulator.org/mantis/view.php?id=6327 and fixes the behaviour regression in http://opensimulator.org/mantis/view.php?id=6483 Animations may still exhibit different behaviour if both scripts and clients are adjusting animations. A change in the behaviour of client AO to not remove all animations may be a better long term approach. --- .../Framework/Scenes/Animation/AnimationSet.cs | 15 +++++++++++++-- .../Scenes/Animation/ScenePresenceAnimator.cs | 14 +++++++++++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 65ae445950..66edfed393 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation return false; } - public bool Remove(UUID animID) + /// + /// Remove the specified animation + /// + /// + /// + /// If true, then the default animation can be entirely removed. + /// If false, then removing the default animation will reset it to the simulator default (currently STAND). + /// + public bool Remove(UUID animID, bool allowNoDefault) { lock (m_animations) { if (m_defaultAnimation.AnimID == animID) { - m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); + if (allowNoDefault) + m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); + else + ResetDefaultAnimation(); } else if (HasAnimation(animID)) { diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 5b16b67916..3657dc4ebc 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -109,14 +109,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation AddAnimation(animID, objectID); } - public void RemoveAnimation(UUID animID) + /// + /// Remove the specified animation + /// + /// + /// + /// If true, then the default animation can be entirely removed. + /// If false, then removing the default animation will reset it to the simulator default (currently STAND). + /// + public void RemoveAnimation(UUID animID, bool allowNoDefault) { if (m_scenePresence.IsChildAgent) return; // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name); - if (m_animations.Remove(animID)) + if (m_animations.Remove(animID, allowNoDefault)) SendAnimPack(); } @@ -132,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (animID == UUID.Zero) return; - RemoveAnimation(animID); + RemoveAnimation(animID, true); } public void ResetAnimations() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6979c33d11..c295305a7d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2260,7 +2260,7 @@ namespace OpenSim.Region.Framework.Scenes public void HandleStopAnim(IClientAPI remoteClient, UUID animID) { - Animator.RemoveAnimation(animID); + Animator.RemoveAnimation(animID, false); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d47fd6b5ac..a2f1ff2e95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3364,7 +3364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (animID == UUID.Zero) presence.Animator.RemoveAnimation(anim); else - presence.Animator.RemoveAnimation(animID); + presence.Animator.RemoveAnimation(animID, true); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 25635ff767..5c0ff1c6c4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -986,7 +986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (animID == UUID.Zero) target.Animator.RemoveAnimation(animation); else - target.Animator.RemoveAnimation(animID); + target.Animator.RemoveAnimation(animID, true); } } } From 115e1c2abb7755eb7b5ffeafbc0aecd255ccfc4e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Jan 2013 23:22:02 +0000 Subject: [PATCH 4/8] Add "debug set set animations true|false" region console command. Setting this logs extra information about animation add/remove, such as uuid and animation name Unfortunately cannot be done per client yet --- .../Scenes/Animation/ScenePresenceAnimator.cs | 33 ++++++++++++++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++ .../Animations/AnimationsCommandModule.cs | 23 +++---------- .../SceneCommands/SceneCommandsModule.cs | 11 +++++++ 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3657dc4ebc..e92a087625 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -86,7 +86,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; -// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", + GetAnimName(animID), animID, m_scenePresence.Name); if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) SendAnimPack(); @@ -122,7 +125,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; -// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", + GetAnimName(animID), animID, m_scenePresence.Name); if (m_animations.Remove(animID, allowNoDefault)) SendAnimPack(); @@ -145,9 +151,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void ResetAnimations() { -// m_log.DebugFormat( -// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", -// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", + m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); m_animations.Clear(); } @@ -558,5 +565,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation SendAnimPack(animIDs, sequenceNums, objectIDs); } + + public string GetAnimName(UUID animId) + { + string animName; + + if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) + { + AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString()); + if (amd != null) + animName = amd.Name; + else + animName = "Unknown"; + } + + return animName; + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4859dffadb..5778176e44 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -67,6 +67,11 @@ namespace OpenSim.Region.Framework.Scenes public bool EmergencyMonitoring = false; + /// + /// Show debug information about animations. + /// + public bool DebugAnimations { get; set; } + /// /// Show debug information about teleports. /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs index e951d9e37c..84211a9ba9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs @@ -161,12 +161,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations UUID defaultAnimId = anims.DefaultAnimation.AnimID; cdl.AddRow( "Default anim", - string.Format("{0}, {1}", defaultAnimId, GetAnimName(sp.Scene.AssetService, defaultAnimId))); + string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId))); UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID; cdl.AddRow( "Implicit default anim", - string.Format("{0}, {1}", implicitDefaultAnimId, GetAnimName(sp.Scene.AssetService, implicitDefaultAnimId))); + string.Format("{0}, {1}", + implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId))); cdl.AddToStringBuilder(sb); @@ -185,7 +186,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations for (int i = 0; i < animIds.Length; i++) { UUID animId = animIds[i]; - string animName = GetAnimName(sp.Scene.AssetService, animId); + string animName = sp.Animator.GetAnimName(animId); int seq = sequenceNumbers[i]; UUID objectId = objectIds[i]; @@ -195,21 +196,5 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations cdt.AddToStringBuilder(sb); sb.Append("\n"); } - - private string GetAnimName(IAssetService assetService, UUID animId) - { - string animName; - - if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) - { - AssetMetadata amd = assetService.GetMetadata(animId.ToString()); - if (amd != null) - animName = amd.Name; - else - animName = "Unknown"; - } - - return animName; - } } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs index 8b8758e59c..521141a851 100644 --- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments "debug scene get", "List current scene options.", "If active is false then main scene update and maintenance loops are suspended.\n" + + "If animations is true then extra animations debug information is logged.\n" + "If collisions is false then collisions with other objects are turned off.\n" + "If pbackup is false then periodic scene backup is turned off.\n" + "If physics is false then all physics objects are non-physical.\n" @@ -107,6 +108,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments "debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false", "Turn on scene debugging options.", "If active is false then main scene update and maintenance loops are suspended.\n" + + "If animations is true then extra animations debug information is logged.\n" + "If collisions is false then collisions with other objects are turned off.\n" + "If pbackup is false then periodic scene backup is turned off.\n" + "If physics is false then all physics objects are non-physical.\n" @@ -135,6 +137,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments { ConsoleDisplayList cdl = new ConsoleDisplayList(); cdl.AddRow("active", m_scene.Active); + cdl.AddRow("animations", m_scene.DebugAnimations); cdl.AddRow("pbackup", m_scene.PeriodicBackup); cdl.AddRow("physics", m_scene.PhysicsEnabled); cdl.AddRow("scripting", m_scene.ScriptsEnabled); @@ -178,6 +181,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments m_scene.Active = active; } + if (options.ContainsKey("animations")) + { + bool active; + + if (bool.TryParse(options["animations"], out active)) + m_scene.DebugAnimations = active; + } + if (options.ContainsKey("pbackup")) { bool active; From 652cfa2ee2ce54c4b53fc4001a715406d66c3cf1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 19 Jan 2013 00:27:17 +0000 Subject: [PATCH 5/8] Fix use of scene debug commands when region is set to root or a specific region where there is more than one region on the simulator. --- .../SceneCommands/SceneCommandsModule.cs | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs index 521141a851..12169ab617 100644 --- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs @@ -122,10 +122,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments { if (args.Length == 3) { - if (MainConsole.Instance.ConsoleScene == null) - MainConsole.Instance.Output("Please use 'change region ' first"); - else - OutputSceneDebugOptions(); + if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) + return; + + OutputSceneDebugOptions(); } else { @@ -144,6 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments cdl.AddRow("teleport", m_scene.DebugTeleporting); cdl.AddRow("updates", m_scene.DebugUpdates); + MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name); MainConsole.Instance.Output(cdl.ToString()); } @@ -151,18 +152,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments { if (args.Length == 5) { - if (MainConsole.Instance.ConsoleScene == null) - { - MainConsole.Instance.Output("Please use 'change region ' first"); - } - else - { - string key = args[3]; - string value = args[4]; - SetSceneDebugOptions(new Dictionary() { { key, value } }); + if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) + return; - MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); - } + string key = args[3]; + string value = args[4]; + SetSceneDebugOptions(new Dictionary() { { key, value } }); + + MainConsole.Instance.OutputFormat("Set {0} debug scene {1} = {2}", m_scene.Name, key, value); } else { From 4f70e423df97f3fd52f4a36ac296f696f46b7d34 Mon Sep 17 00:00:00 2001 From: Talun Date: Fri, 18 Jan 2013 19:16:21 +0000 Subject: [PATCH 6/8] Mantis 6507 keys returned by llGetAgentList incorrect for llList2Key The type of the keys returned by llGetAgentList corrected to LSL_Key --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a2f1ff2e95..50597b7fda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5793,13 +5793,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (parcelOwned && land.LandData.OwnerID == id || parcel && land.LandData.GlobalID == id) { - result.Add(ssp.UUID.ToString()); + result.Add(new LSL_Key(ssp.UUID.ToString())); } } } else { - result.Add(ssp.UUID.ToString()); + result.Add(new LSL_Key(ssp.UUID.ToString())); } } // Maximum of 100 results From 27e2ec177a7e44e5456c7f18c1256b79a9655151 Mon Sep 17 00:00:00 2001 From: Talun Date: Mon, 14 Jan 2013 18:17:33 +0000 Subject: [PATCH 7/8] New constants for llGetObjectDetails New constants for llGetObjectDetails OBJECT_CHARACTER_TIME, OBJECT_ROOT, OBJECT_ATTACHED_POINT, OBJECT_PATHFINDING_TYPE, OBJECT_PHYSICS, OBJECT_PHANTOM and OBJECT_TEMP_ON_REZ also Pathfining constants, 3 of which are used by llGetObjectDetails --- .../Shared/Api/Implementation/LSL_Api.cs | 75 +++++++++++++++++++ .../Shared/Api/Runtime/LSL_Constants.cs | 17 +++++ 2 files changed, 92 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 50597b7fda..db5add19e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10590,6 +10590,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_PHYSICS_COST: ret.Add(new LSL_Float(0)); break; + case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_ROOT: + SceneObjectPart p = av.ParentPart; + if (p != null) + { + ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString())); + } + else + { + ret.Add(new LSL_String(id)); + } + break; + case ScriptBaseClass.OBJECT_ATTACHED_POINT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR)); + break; + case ScriptBaseClass.OBJECT_PHYSICS: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_PHANTOM: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_TEMP_ON_REZ: + ret.Add(new LSL_Integer(0)); + break; default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); @@ -10685,6 +10714,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // The value returned in SL for normal prims looks like the prim count ret.Add(new LSL_Float(0)); break; + case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_ROOT: + ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString())); + break; + case ScriptBaseClass.OBJECT_ATTACHED_POINT: + ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint)); + break; + case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: + byte pcode = obj.Shape.PCode; + if (obj.ParentGroup.AttachmentPoint != 0 + || pcode == (byte)PCode.Grass + || pcode == (byte)PCode.Tree + || pcode == (byte)PCode.NewTree) + { + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER)); + } + else + { + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET)); + } + break; + case ScriptBaseClass.OBJECT_PHYSICS: + if (obj.ParentGroup.AttachmentPoint != 0) + { + ret.Add(new LSL_Integer(0)); // Always false if attached + } + else + { + ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0)); + } + break; + case ScriptBaseClass.OBJECT_PHANTOM: + if (obj.ParentGroup.AttachmentPoint != 0) + { + ret.Add(new LSL_Integer(0)); // Always false if attached + } + else + { + ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0)); + } + break; + case ScriptBaseClass.OBJECT_TEMP_ON_REZ: + ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); + break; default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 880841b5d9..9bf1a64cf9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -556,6 +556,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_SERVER_COST = 14; public const int OBJECT_STREAMING_COST = 15; public const int OBJECT_PHYSICS_COST = 16; + public const int OBJECT_CHARACTER_TIME = 17; + public const int OBJECT_ROOT = 18; + public const int OBJECT_ATTACHED_POINT = 19; + public const int OBJECT_PATHFINDING_TYPE = 20; + public const int OBJECT_PHYSICS = 21; + public const int OBJECT_PHANTOM = 22; + public const int OBJECT_TEMP_ON_REZ = 23; + + // Pathfinding types + public const int OPT_OTHER = -1; + public const int OPT_LEGACY_LINKSET = 0; + public const int OPT_AVATAR = 1; + public const int OPT_CHARACTER = 2; + public const int OPT_WALKABLE = 3; + public const int OPT_STATIC_OBSTACLE = 4; + public const int OPT_MATERIAL_VOLUME = 5; + public const int OPT_EXCLUSION_VOLUME = 6; // for llGetAgentList public const int AGENT_LIST_PARCEL = 1; From 3eee991935393feeee753ced28c794f12367f19d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 19 Jan 2013 02:04:36 +0000 Subject: [PATCH 8/8] Explicitly stop PollServiceRequestManager() rather than relying on its destructor. Hopes to address occasional shutdown failures from http://opensimulator.org/mantis/view.php?id=6503 --- .../Servers/HttpServer/BaseHttpServer.cs | 3 +++ .../HttpServer/PollServiceRequestManager.cs | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 85b19c067e..251a8ad3ce 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1731,6 +1731,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); + m_PollServiceManager.Start(); HTTPDRunning = true; //HttpListenerContext context; @@ -1781,6 +1782,8 @@ namespace OpenSim.Framework.Servers.HttpServer HTTPDRunning = false; try { + m_PollServiceManager.Stop(); + m_httpListener2.ExceptionThrown -= httpServerException; //m_httpListener2.DisconnectHandler = null; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 8d5015110d..3e84c55a17 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -45,19 +45,26 @@ namespace OpenSim.Framework.Servers.HttpServer private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; private PollServiceWorkerThread[] m_PollServiceWorkerThreads; - private bool m_running = true; + private volatile bool m_running = true; + private int m_pollTimeout; public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { m_server = pSrv; m_WorkerThreadCount = pWorkerThreadCount; + m_pollTimeout = pTimeout; + } + + public void Start() + { + m_running = true; m_workerThreads = new Thread[m_WorkerThreadCount]; m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; //startup worker threads for (uint i = 0; i < m_WorkerThreadCount; i++) { - m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout); + m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout); m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; m_workerThreads[i] @@ -136,8 +143,10 @@ namespace OpenSim.Framework.Servers.HttpServer } - ~PollServiceRequestManager() + public void Stop() { + m_running = false; + foreach (object o in m_requests) { PollServiceHttpRequest req = (PollServiceHttpRequest) o; @@ -151,8 +160,6 @@ namespace OpenSim.Framework.Servers.HttpServer { t.Abort(); } - - m_running = false; } } } \ No newline at end of file