Merge branch 'avination' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
avinationmerge
Melanie 2012-05-31 03:37:43 +01:00
commit e696d1d952
7 changed files with 246 additions and 219 deletions

View File

@ -3761,24 +3761,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
SceneObjectPart part = (SceneObjectPart)update.Entity;
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
// safety measure.
//
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
// updates and kills on different threads with different scheduling strategies, hence this protection.
//
// This doesn't appear to apply to child prims - a client will happily ignore these updates
// after the root prim has been deleted.
lock (m_killRecord)
{
if (m_killRecord.Contains(part.LocalId))
continue;
if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
continue;
}
if (part.ParentGroup.IsDeleted)
continue;
@ -3816,7 +3798,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// attachments until the avatar becomes root.
if (sp.IsChildAgent)
continue;
// If the object is an attachment we don't want it to be in the kill
// record. Else attaching from inworld and subsequently dropping
// it will no longer work.
lock (m_killRecord)
{
m_killRecord.Remove(part.LocalId);
m_killRecord.Remove(part.ParentGroup.RootPart.LocalId);
}
}
else
{
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
// safety measure.
//
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
// updates and kills on different threads with different scheduling strategies, hence this protection.
//
// This doesn't appear to apply to child prims - a client will happily ignore these updates
// after the root prim has been deleted.
//
// We ignore this for attachments because attaching something from inworld breaks unless we do.
lock (m_killRecord)
{
if (m_killRecord.Contains(part.LocalId))
continue;
if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
continue;
}
}
if (part.ParentGroup.IsAttachment && m_disableFacelights)
{
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&

View File

@ -638,19 +638,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
// grp.Name, grp.LocalId, remoteClient.Name);
Vector3 inventoryStoredPosition = new Vector3
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
? (float)Constants.RegionSize - 6
: grp.AbsolutePosition.X)
,
(grp.AbsolutePosition.Y > (int)Constants.RegionSize)
? (float)Constants.RegionSize - 6
: grp.AbsolutePosition.Y,
grp.AbsolutePosition.Z);
Vector3 originalPosition = grp.AbsolutePosition;
grp.AbsolutePosition = inventoryStoredPosition;
// Vector3 inventoryStoredPosition = new Vector3
// (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
// ? (float)Constants.RegionSize - 6
// : grp.AbsolutePosition.X)
// ,
// (grp.AbsolutePosition.Y > (int)Constants.RegionSize)
// ? (float)Constants.RegionSize - 6
// : grp.AbsolutePosition.Y,
// grp.AbsolutePosition.Z);
//
// Vector3 originalPosition = grp.AbsolutePosition;
//
// grp.AbsolutePosition = inventoryStoredPosition;
// If we're being called from a script, then trying to serialize that same script's state will not complete
// in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// without state on relog. Arguably, this is what we want anyway.
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
grp.AbsolutePosition = originalPosition;
// grp.AbsolutePosition = originalPosition;
AssetBase asset = m_scene.CreateAsset(
grp.GetPartName(grp.LocalId),
@ -686,21 +686,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
else // oopsies
item.Folder = UUID.Zero;
// Nix the special bits we used to use for slam and the folded perms
uint allowablePermissionsMask = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move);
if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions())
{
item.BasePermissions = grp.RootPart.NextOwnerMask;
item.CurrentPermissions = grp.RootPart.NextOwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
item.BasePermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask;
item.CurrentPermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask;
item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask;
item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask;
}
else
{
item.BasePermissions = grp.RootPart.BaseMask;
item.CurrentPermissions = grp.RootPart.OwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask;
item.GroupPermissions = grp.RootPart.GroupMask;
item.BasePermissions = grp.RootPart.BaseMask & allowablePermissionsMask;
item.CurrentPermissions = grp.RootPart.OwnerMask & allowablePermissionsMask;
item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask & allowablePermissionsMask;
item.GroupPermissions = grp.RootPart.GroupMask & allowablePermissionsMask;
}
item.CreationDate = Util.UnixTimeSinceEpoch();

View File

@ -2738,7 +2738,7 @@ namespace OpenSim.Region.Framework.Scenes
SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
if (!VolumeDetectActive)
SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd);
if (startedColliders.Contains(0))

View File

@ -4287,199 +4287,199 @@ namespace OpenSim.Region.Framework.Scenes
}
}
private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
private DetectedObject CreateDetObject(SceneObjectPart obj)
{
/*
lock(m_collisionEventLock)
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
return detobj;
}
private DetectedObject CreateDetObject(ScenePresence av)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
return detobj;
}
private DetectedObject CreateDetObjectForGround()
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
return detobj;
}
private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders)
{
ColliderArgs colliderArgs = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in colliders)
{
if (m_collisionEventFlag)
return;
m_collisionEventFlag = true;
if (localId == 0)
continue;
SceneObjectPart obj = m_scene.GetSceneObjectPart(localId);
if (obj != null)
{
if (!dest.CollisionFilteredOut(obj.UUID, obj.Name))
colliding.Add(CreateDetObject(obj));
}
else
{
ScenePresence av = m_scene.GetScenePresence(localId);
if (av != null && (!av.IsChildAgent))
{
if (!dest.CollisionFilteredOut(av.UUID, av.Name))
colliding.Add(CreateDetObject(av));
}
}
}
Util.FireAndForget(delegate(object x)
colliderArgs.Colliders = colliding;
return colliderArgs;
}
private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message);
private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify)
{
ColliderArgs CollidingMessage;
if (colliders.Count > 0)
{
*/
try
if ((dest.RootPart.ScriptEvents & ev) != 0)
{
List<uint> thisHitColliders = new List<uint>();
List<uint> endedColliders = new List<uint>();
List<uint> startedColliders = new List<uint>();
List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
CollisionForSoundInfo soundinfo;
ContactPoint curcontact;
CollidingMessage = CreateColliderArgs(dest.RootPart, colliders);
if (coldata.Count == 0)
if (CollidingMessage.Colliders.Count > 0)
notify(dest.RootPart.LocalId, CollidingMessage);
}
}
}
private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify)
{
if ((dest.RootPart.ScriptEvents & ev) != 0)
{
ColliderArgs LandCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
colliding.Add(CreateDetObjectForGround());
LandCollidingMessage.Colliders = colliding;
notify(dest.RootPart.LocalId, LandCollidingMessage);
}
}
private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
{
try
{
List<uint> thisHitColliders = new List<uint>();
List<uint> endedColliders = new List<uint>();
List<uint> startedColliders = new List<uint>();
List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
CollisionForSoundInfo soundinfo;
ContactPoint curcontact;
if (coldata.Count == 0)
{
if (m_lastColliders.Count == 0)
return; // nothing to do
foreach (uint localID in m_lastColliders)
{
if (m_lastColliders.Count == 0)
return; // nothing to do
endedColliders.Add(localID);
}
m_lastColliders.Clear();
}
foreach (uint localID in m_lastColliders)
else
{
foreach (uint id in coldata.Keys)
{
thisHitColliders.Add(id);
if (!m_lastColliders.Contains(id))
{
startedColliders.Add(id);
curcontact = coldata[id];
if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
{
soundinfo = new CollisionForSoundInfo();
soundinfo.colliderID = id;
soundinfo.position = curcontact.Position;
soundinfo.relativeVel = curcontact.RelativeSpeed;
soundinfolist.Add(soundinfo);
}
}
//m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
// calculate things that ended colliding
foreach (uint localID in m_lastColliders)
{
if (!thisHitColliders.Contains(localID))
{
endedColliders.Add(localID);
}
m_lastColliders.Clear();
}
else
//add the items that started colliding this time to the last colliders list.
foreach (uint localID in startedColliders)
{
foreach (uint id in coldata.Keys)
{
thisHitColliders.Add(id);
if (!m_lastColliders.Contains(id))
{
startedColliders.Add(id);
curcontact = coldata[id];
if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
{
soundinfo = new CollisionForSoundInfo();
soundinfo.colliderID = id;
soundinfo.position = curcontact.Position;
soundinfo.relativeVel = curcontact.RelativeSpeed;
soundinfolist.Add(soundinfo);
}
}
//m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
// calculate things that ended colliding
foreach (uint localID in m_lastColliders)
{
if (!thisHitColliders.Contains(localID))
{
endedColliders.Add(localID);
}
}
//add the items that started colliding this time to the last colliders list.
foreach (uint localID in startedColliders)
{
m_lastColliders.Add(localID);
}
// remove things that ended colliding from the last colliders list
foreach (uint localID in endedColliders)
{
m_lastColliders.Remove(localID);
}
if (soundinfolist.Count > 0)
CollisionSounds.AvatarCollisionSound(this, soundinfolist);
// do event notification
if (startedColliders.Count > 0)
{
ColliderArgs StartCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
continue;
SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
StartCollidingMessage.Colliders = colliding;
foreach (SceneObjectGroup att in GetAttachments())
Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
}
}
m_lastColliders.Add(localID);
}
if (endedColliders.Count > 0)
// remove things that ended colliding from the last colliders list
foreach (uint localID in endedColliders)
{
ColliderArgs EndCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in endedColliders)
{
if (localId == 0)
continue;
SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
EndCollidingMessage.Colliders = colliding;
foreach (SceneObjectGroup att in GetAttachments())
Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage);
}
m_lastColliders.Remove(localID);
}
if (thisHitColliders.Count > 0)
{
ColliderArgs CollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in thisHitColliders)
{
if (localId == 0)
continue;
SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
CollidingMessage.Colliders = colliding;
lock (m_attachments)
{
foreach (SceneObjectGroup att in m_attachments)
Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
}
}
}
if (soundinfolist.Count > 0)
CollisionSounds.AvatarCollisionSound(this, soundinfolist);
}
finally
foreach (SceneObjectGroup att in GetAttachments())
{
m_collisionEventFlag = false;
SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart);
SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding);
SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd);
if (startedColliders.Contains(0))
SendLandCollisionEvent(att, scriptEvents.land_collision_start, m_scene.EventManager.TriggerScriptLandCollidingStart);
if (m_lastColliders.Contains(0))
SendLandCollisionEvent(att, scriptEvents.land_collision, m_scene.EventManager.TriggerScriptLandColliding);
if (endedColliders.Contains(0))
SendLandCollisionEvent(att, scriptEvents.land_collision_end, m_scene.EventManager.TriggerScriptLandCollidingEnd);
}
// });
}
finally
{
m_collisionEventFlag = false;
}
}
private void TeleportFlagsDebug() {

View File

@ -1118,6 +1118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate();
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
_parent_scene.AddCollisionEventReporting(this);
}
public void SendCollisions()

View File

@ -1621,12 +1621,13 @@ namespace OpenSim.Region.Physics.OdePlugin
if (Body != IntPtr.Zero)
{
d.BodyDestroy(Body);
Body = IntPtr.Zero;
// d.BodyDestroy(Body);
// Body = IntPtr.Zero;
// do a more complet destruction
DestroyBody();
m_log.Warn("[PHYSICS]: MakeBody called having a body");
}
if (d.GeomGetBody(prim_geom) != IntPtr.Zero)
{
d.GeomSetBody(prim_geom, IntPtr.Zero);
@ -3320,6 +3321,10 @@ namespace OpenSim.Region.Physics.OdePlugin
protected void changeBuilding(bool newbuilding)
{
// Check if we need to do anything
if (newbuilding == m_building)
return;
if ((bool)newbuilding)
{
m_building = true;

View File

@ -1272,6 +1272,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!allow)
return;
if (m_host.ParentGroup.RootPart.PhysActor != null &&
m_host.ParentGroup.RootPart.PhysActor.IsPhysical)
return;
m_host.ScriptSetPhysicsStatus(true);
}
else