Merge branch 'master' into careminster

Conflicts:
	OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
	OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
	OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
avinationmerge
Melanie 2013-01-19 02:38:04 +00:00
commit 12efac494a
14 changed files with 226 additions and 55 deletions

View File

@ -1830,6 +1830,8 @@ namespace OpenSim.Framework.Servers.HttpServer
HTTPDRunning = false;
try
{
// m_PollServiceManager.Stop();
m_httpListener2.ExceptionThrown -= httpServerException;
//m_httpListener2.DisconnectHandler = null;

View File

@ -50,19 +50,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]
@ -141,8 +148,10 @@ namespace OpenSim.Framework.Servers.HttpServer
}
~PollServiceRequestManager()
public void Stop()
{
m_running = false;
foreach (object o in m_requests)
{
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
@ -157,7 +166,6 @@ namespace OpenSim.Framework.Servers.HttpServer
{
t.Abort();
}
m_running = false;
}
}
}

View File

@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation
return false;
}
public bool Remove(UUID animID)
/// <summary>
/// Remove the specified animation
/// </summary>
/// <param name='animID'></param>
/// <param name='allowNoDefault'>
/// 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).
/// </param>
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))
{

View File

@ -87,6 +87,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
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();
@ -109,14 +113,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation
AddAnimation(animID, objectID);
}
public void RemoveAnimation(UUID animID)
/// <summary>
/// Remove the specified animation
/// </summary>
/// <param name='animID'></param>
/// <param name='allowNoDefault'>
/// 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).
/// </param>
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_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))
if (m_animations.Remove(animID, allowNoDefault))
SendAnimPack();
}
@ -130,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (addRemove)
m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero);
else
m_animations.Remove(animID);
m_animations.Remove(animID, true);
}
if(sendPack)
SendAnimPack();
@ -148,14 +163,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (animID == UUID.Zero)
return;
RemoveAnimation(animID);
RemoveAnimation(animID, true);
}
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();
}
@ -566,5 +582,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;
}
}
}

View File

@ -67,6 +67,11 @@ namespace OpenSim.Region.Framework.Scenes
public bool EmergencyMonitoring = false;
/// <summary>
/// Show debug information about animations.
/// </summary>
public bool DebugAnimations { get; set; }
/// <summary>
/// Show debug information about teleports.
/// </summary>

View File

@ -2435,7 +2435,7 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
{
Animator.RemoveAnimation(animID);
Animator.RemoveAnimation(animID, false);
}
public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)

View File

@ -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;
}
}
}

View File

@ -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"
@ -120,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 <regioname>' first");
else
OutputSceneDebugOptions();
if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null)
return;
OutputSceneDebugOptions();
}
else
{
@ -135,12 +137,14 @@ 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);
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());
}
@ -148,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 <regioname>' first");
}
else
{
string key = args[3];
string value = args[4];
SetSceneDebugOptions(new Dictionary<string, string>() { { 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<string, string>() { { key, value } });
MainConsole.Instance.OutputFormat("Set {0} debug scene {1} = {2}", m_scene.Name, key, value);
}
else
{
@ -178,6 +178,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;

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -3708,7 +3708,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);
}
}
}
@ -6228,13 +6228,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
@ -11528,6 +11528,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));
@ -11619,6 +11648,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// The value returned in SL for normal prims is prim count
ret.Add(new LSL_Float(obj.PhysicsCost));
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));

View File

@ -995,7 +995,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);
}
}
}

View File

@ -557,6 +557,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;