Merge branch 'dev_kitty' of ssh://island.sciencesim.com/home/sceneapi/sceneapi into physbucket

Conflicts:
	OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncAvatar.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
dsg
Robert Adams 2011-02-24 14:48:11 -08:00
commit f212a60067
13 changed files with 206 additions and 36 deletions

View File

@ -601,7 +601,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
{
<<<<<<< HEAD
// m_log.Debug("[REGION SYNC AVATAR] SendPrimUpdate");
=======
//m_log.Debug("[REGION SYNC AVATAR] SendPrimUpdate");
>>>>>>> 513ca97eb038efea3dd7685a314b3f64e8770784
}
public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)

View File

@ -395,7 +395,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
RegionSyncAvatar av = new RegionSyncAvatar(m_scene, agentID, first, last, startPos);
m_remoteAvatars.Add(agentID, av);
m_scene.AddNewClient(av);
//m_scene.AddNewClient(av);
m_scene.AddNewClient2(av, true, false);
m_scene.TryGetScenePresence(agentID, out sp);
if (sp == null)
{

View File

@ -374,7 +374,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
m_syncedAvatars.Add(agentID, av);
}
m_scene.AddNewClient(av);
//m_scene.AddNewClient(av);
m_scene.AddNewClient2(av, true, false);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Handled AddAgent for UUID {0} at {1}", agentID, startPos.ToString()));
return;
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration, if the local actor is configured to be a client manager, load this module.
if (!actorType.Equals("client_manager"))
{
m_log.Warn(LogHeader + ": not configured as Scene Persistence Actor. Shut down.");
m_log.Warn(LogHeader + ": not configured as Client Manager Actor. Shut down.");
return;
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration, if the local actor is configured to be a client manager, load this module.
if (!actorType.Equals("physics_engine"))
{
m_log.Warn(LogHeader + ": not configured as Scene Persistence Actor. Shut down.");
m_log.Warn(LogHeader + ": not configured as Physics Engine Actor. Shut down.");
return;
}

View File

@ -699,6 +699,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case EventManager.EventNames.ObjectDeGrab:
OnLocalDeGrabObject((uint)evArgs[0], (uint)evArgs[1], (IClientAPI)evArgs[2], (SurfaceTouchEventArgs)evArgs[3]);
return;
case EventManager.EventNames.Attach:
OnLocalAttach((uint)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2]);
return;
default:
return;
}
@ -1438,6 +1441,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ObjectGrab:
case SymmetricSyncMessage.MsgType.ObjectGrabbing:
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
case SymmetricSyncMessage.MsgType.Attach:
{
HandleRemoteEvent(msg, senderActorID);
return;
@ -1773,6 +1777,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
HandleRemoteEvent_OnObjectDeGrab(init_actorID, evSeqNum, data);
break;
case SymmetricSyncMessage.MsgType.Attach:
HandleRemoteEvent_OnAttach(init_actorID, evSeqNum, data);
break;
}
//if this is a relay node, forwards the event
@ -2025,6 +2032,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.EventManager.TriggerObjectDeGrabLocally(part.LocalId, originalID, remoteClinet, surfaceArgs);
}
private void HandleRemoteEvent_OnAttach(string actorID, ulong evSeqNum, OSDMap data)
{
UUID primID = data["primID"].AsUUID();
UUID itemID = data["itemID"].AsUUID();
UUID avatarID = data["avatarID"].AsUUID();
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
if (part == null)
{
m_log.Warn(LogHeader + ", HandleRemoteEvent_OnAttach: no part with UUID " + primID + " found");
return;
}
uint localID = part.LocalId;
m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID);
}
/// <summary>
/// The handler for (locally initiated) event OnNewScript: triggered by client's RezSript packet, publish it to other actors.
@ -2135,6 +2160,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data);
}
private void OnLocalAttach(uint localID, UUID itemID, UUID avatarID)
{
OSDMap data = new OSDMap();
SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
if (part == null)
{
m_log.Warn(LogHeader + ", OnLocalAttach: no part with localID: " + localID);
return;
}
data["primID"] = OSD.FromUUID(part.UUID);
data["itemID"] = OSD.FromUUID(itemID);
data["avatarID"] = OSD.FromUUID(avatarID);
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
}
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
/*
@ -2246,6 +2287,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
private void SendSceneEvent(SymmetricSyncMessage.MsgType msgType, OSDMap data)
{
data["actorID"] = OSD.FromString(m_actorID);

View File

@ -45,6 +45,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
ObjectGrab,
ObjectGrabbing,
ObjectDeGrab,
Attach,
}
#endregion

View File

@ -58,6 +58,7 @@ namespace OpenSim.Region.Framework.Scenes
ObjectGrab,
ObjectGrabbing,
ObjectDeGrab,
Attach, //attaching object to avatar
}
@ -238,6 +239,25 @@ namespace OpenSim.Region.Framework.Scenes
base.TriggerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs);
}
public override void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
{
if (m_scene.RegionSyncModule != null)
{
Object[] eventArgs = new Object[4];
eventArgs[0] = (Object)localID;
eventArgs[1] = (Object)itemID;
eventArgs[2] = (Object)avatarID;
m_scene.RegionSyncModule.PublishSceneEvent(EventNames.Attach, eventArgs);
}
TriggerOnAttachLocally(localID, itemID, avatarID);
}
public void TriggerOnAttachLocally(uint localID, UUID itemID, UUID avatarID)
{
base.TriggerOnAttach(localID, itemID, avatarID);
}
#endregion //GrabObject
}
@ -645,7 +665,8 @@ namespace OpenSim.Region.Framework.Scenes
public event LandBuy OnLandBuy;
public event LandBuy OnValidateLandBuy;
public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
//public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
public virtual void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
{
Attach handlerOnAttach = OnAttach;
if (handlerOnAttach != null)

View File

@ -2978,9 +2978,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client)
{
AddNewClient2(client, true);
//AddNewClient2(client, true);
AddNewClient2(client, true, true);
}
public void AddNewClient2(IClientAPI client, bool managed)
//public void AddNewClient2(IClientAPI client, bool managed)
public void AddNewClient2(IClientAPI client, bool managed, bool rezAttachment)
{
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
@ -3019,6 +3021,7 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
{
sp.IsChildAgent = false;
if(rezAttachment)
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
}
}

View File

@ -2061,10 +2061,15 @@ namespace OpenSim.Region.Framework.Scenes
}
m_numPrim += children.Length;
//SYMMETRIC SYNC,
sceneObject.AttachToScene(m_parentScene);
//sceneObject.AttachToSceneBySync(m_parentScene);
//end of SYMMETRIC SYNC,
//Take some special care of the case of this object being an attachment
sceneObject.RootPart.SetAttachmentPoint(sceneObject.RootPart.AttachmentPoint);
if (sceneObject.IsAttachment)
{
ScenePresence avatar = m_parentScene.GetScenePresence(sceneObject.RootPart.AttachedAvatar);
sceneObject.RootPart.SetParentLocalId(avatar.LocalId);
}
//SYMMETRIC SYNC,
sceneObject.ScheduleGroupForFullUpdate_SyncInfoUnchanged();

View File

@ -2909,7 +2909,12 @@ namespace OpenSim.Region.Framework.Scenes
//we need to do a terse update even if the move wasn't allowed
// so that the position is reset in the client (the object snaps back)
//ScheduleGroupForTerseUpdate();
ScheduleGroupForTerseUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.GroupPosition});
List<SceneObjectPartProperties> updatedProperties = new List<SceneObjectPartProperties>() { SceneObjectPartProperties.GroupPosition };
if (IsAttachment)
{
updatedProperties.Add(SceneObjectPartProperties.AttachedPos);
}
ScheduleGroupForTerseUpdate(updatedProperties);
}
/// <summary>

View File

@ -227,19 +227,49 @@ namespace OpenSim.Region.Framework.Scenes
}
public bool IsAttachment;
//public bool IsAttachment;
private bool m_isAttachment;
public bool IsAttachment
{
get { return m_isAttachment; }
set { m_isAttachment = value; }
}
public scriptEvents AggregateScriptEvents;
//public scriptEvents AggregateScriptEvents;
private scriptEvents m_aggregateScriptEvents;
public scriptEvents AggregateScriptEvents
{
get { return m_aggregateScriptEvents; }
set { m_aggregateScriptEvents = value; }
}
public UUID AttachedAvatar;
//public UUID AttachedAvatar;
private UUID m_attachedAvatar;
public UUID AttachedAvatar
{
get { return m_attachedAvatar; }
set { m_attachedAvatar = value; }
}
public Vector3 AttachedPos;
//public Vector3 AttachedPos;
private Vector3 m_attachedPos;
public Vector3 AttachedPos
{
get { return m_attachedPos; }
set { m_attachedPos = value; }
}
public uint AttachmentPoint;
//public uint AttachmentPoint;
private uint m_attachmentPoint;
public uint AttachmentPoint
{
get { return m_attachmentPoint; }
set { m_attachmentPoint = value; }
}
public Vector3 RotationAxis = Vector3.One;
@ -741,11 +771,14 @@ namespace OpenSim.Region.Framework.Scenes
}
if (IsAttachment)
{
if (m_parentGroup != null) //need to check this, it would be null while deserialization -- IsAttachment is now serialized
{
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
if (sp != null)
return sp.AbsolutePosition;
}
}
return m_groupPosition;
}
@ -1618,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
//m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
}
}
}
@ -5176,9 +5209,12 @@ namespace OpenSim.Region.Framework.Scenes
IsColliding,
//TODO!!!! To be handled in serialization/deserizaltion for synchronization
AggregateScriptEvents,
IsSelected,
AttachmentPoint,
IsAttachment,
AttachedAvatar,
AttachedPos,
AttachmentPoint,
//TODO!!!! To be handled in serialization/deserizaltion for synchronization
IsSelected,
Sound, //This indicates any Sound related property has changed: Sound, SoundGain, SoundFlags,SoundRadius,
//Addition properties to be added here
@ -5425,6 +5461,23 @@ namespace OpenSim.Region.Framework.Scenes
localPart.TextureAnimation = updatedPart.TextureAnimation;
localPart.ParticleSystem = updatedPart.ParticleSystem;
if (!localPart.AttachedAvatar.Equals(updatedPart.AttachedAvatar))
{
localPart.AttachedAvatar = updatedPart.AttachedAvatar;
ScenePresence avatar = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
localPart.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
}
localPart.AttachedPos = updatedPart.AttachedPos;
localPart.SetAttachmentPoint(updatedPart.AttachmentPoint);
//localPart.AttachmentPoint = updatedPart.AttachmentPoint;
//NOTE!!!! IsAttachment can only be set after AttachedAvatar is set, see GroupPosition get function.
//if (!localPart.AttachedAvatar.Equals(UUID.Zero) && updatedPart.IsAttachment)
//{
// localPart.IsAttachment = updatedPart.IsAttachment;
//}
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;

View File

@ -330,9 +330,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
//SYMMETRIC SYNC
m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp);
//m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID);
m_SOPXmlProcessors.Add("IsAttachment", ProcessIsAttachment);
m_SOPXmlProcessors.Add("AttachedAvatar", ProcessAttachedAvatar);
m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos);
m_SOPXmlProcessors.Add("AttachmentPoint", ProcessAttachmentPoint);
m_SOPXmlProcessors.Add("AggregateScriptEvents", ProcessAggregateScriptEvents);
m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo);
//end of SYMMETRIC SYNC
@ -420,11 +426,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region SOPXmlProcessors
//SYMMETRIC SYNC NOTE: -- assignments in de-serialization should directly set the values w/o triggering SceneObjectPart.UpdateBucketSyncInfo;
//That is, calling SetXXX(value) instead of using "XXX = value".
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
{
obj.AllowedDrop = Util.ReadBoolean(reader);
//obj.SetAllowedDrop(Util.ReadBoolean(reader));
}
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
@ -714,12 +718,38 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{
obj.LastUpdateActorID = reader.ReadElementContentAsString("LastUpdateActorID", string.Empty);
}
* */
private static void ProcessLocalFlags(SceneObjectPart obj, XmlTextReader reader)
{
obj.LocalFlags = Util.ReadEnum<PrimFlags>(reader, "LocalFlags");
}
* */
private static void ProcessIsAttachment(SceneObjectPart obj, XmlTextReader reader)
{
obj.IsAttachment = Util.ReadBoolean(reader);
}
private static void ProcessAttachedAvatar(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachedAvatar = Util.ReadUUID(reader, "AttachedAvatar");
}
private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
}
private static void ProcessAttachmentPoint(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachmentPoint = (uint)reader.ReadElementContentAsInt("AttachmentPoint", string.Empty);
}
private static void ProcessAggregateScriptEvents(SceneObjectPart obj, XmlTextReader reader)
{
obj.AggregateScriptEvents = Util.ReadEnum<scriptEvents>(reader, "AggregateScriptEvents");
}
public static void ProcessBucketSyncInfo(SceneObjectPart obj, XmlTextReader reader)
{
@ -1243,9 +1273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
//SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors
WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options);
//writer.WriteElementString("Flags", sop.Flags.ToString());
//writer.WriteElementString("LocalFlags", sop.Flags.ToString());
//WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options);
//end SYMMETRIC SYNC
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
@ -1255,8 +1283,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
//SYMMETRIC SYNC
//writer.WriteElementString("LastUpdateTimeStamp", sop.LastUpdateTimeStamp.ToString());
//writer.WriteElementString("LastUpdateActorID", sop.LastUpdateActorID);
//These properties are only meaningful for synchronization purpose. For saving oar files, they are not necessary.
//We may remove these if later we use a different method to encode object properties for synchronization.
WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options);
WriteVector(writer, "AttachedPos", sop.AttachedPos);
writer.WriteElementString("AttachmentPoint", sop.AttachmentPoint.ToString());
//writer.WriteElementString("IsAttachment", sop.IsAttachment.ToString().ToLower()); //IsAttachment is written last, so that on deserialization, it will be deserialized later than other Attachment properties
WriteFlags(writer, "AggregateScriptEvents", sop.AggregateScriptEvents.ToString(), options);
WriteBucketSyncInfo(writer, sop.BucketSyncInfoList);
//end of SYMMETRIC SYNC