Merge branch 'dev_kitty_debug' into dev_kitty

dsg
Huaiyu (Kitty) Liu 2011-02-08 15:55:45 -08:00
commit a9ebb3ebae
5 changed files with 268 additions and 59 deletions

View File

@ -795,7 +795,7 @@ namespace OpenSim.Region.Framework.Scenes
//Set the property values as in the incoming copy of the object group
SceneObjectGroup localGroup = root.ParentGroup;
localGroup.UpdateObjectProperties(linkedGroup);
localGroup.UpdateObjectGroupBySync(linkedGroup);
//debug
/*

View File

@ -2299,7 +2299,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
localAfterGroup.UpdateObjectProperties(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]);
localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]);
}
}
}

View File

@ -294,6 +294,11 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_rootPart.GroupPosition; }
set
{
SetAbsolutePosition(value);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].UpdateBucketSyncInfo("GroupPosition");
/*
Vector3 val = value;
//REGION SYNC touched
@ -328,6 +333,39 @@ namespace OpenSim.Region.Framework.Scenes
//m_rootPart.GroupPosition.Z);
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
//}
* */
}
}
public void SetAbsolutePosition(Vector3 value)
{
Vector3 val = value;
//REGION SYNC touched
//if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
// || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
// && !IsAttachmentCheckFull())
if (m_scene.IsBorderCrossing(LocX, LocY, val) && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
{
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
}
//end REGION SYNC touched
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
{
RootPart.ScriptSetPhysicsStatus(false);
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
return;
}
}
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
//parts[i].GroupPosition = val;
parts[i].SetGroupPosition(val);
}
}
@ -465,6 +503,20 @@ namespace OpenSim.Region.Framework.Scenes
#region Constructors
//SYMMETRIC SYNC
public SceneObjectGroup(SceneObjectPart part, bool newGroupBySync)
{
if (!newGroupBySync)
{
SetRootPart(part);
}
else
{
SetRootPartBySync(part);
}
}
/// <summary>
/// Constructor
/// </summary>
@ -3728,7 +3780,8 @@ namespace OpenSim.Region.Framework.Scenes
if (part.LinkNum > linkPart.LinkNum)
{
//part.LinkNum--;
part.SetLinkNum(part.LinkNum--);
int linkNum = part.LinkNum - 1;
part.SetLinkNum(linkNum);
}
}
}
@ -3761,7 +3814,9 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.SetOffsetPosition(new Vector3(0, 0, 0));
linkPart.SetRotationOffset(worldRot);
SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart);
//SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart);
bool newGroupBySync = true;
SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart, newGroupBySync);
m_scene.AddNewSceneObjectBySync(objectGroup, true);
@ -3777,7 +3832,23 @@ namespace OpenSim.Region.Framework.Scenes
return objectGroup;
}
/// <summary>
/// Set a part to act as the root part for this scene object, in which SetLinkNum() is called instead of "LinkNum=".
/// </summary>
/// <param name="part"></param>
public void SetRootPartBySync(SceneObjectPart part)
{
if (part == null)
throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart");
part.SetParent(this);
m_rootPart = part;
if (!IsAttachment)
part.ParentID = 0;
part.SetLinkNum(0);
m_parts.Add(m_rootPart.UUID, m_rootPart);
}
public void ScheduleGroupForFullUpdate_SyncInfoUnchanged()
{
@ -3806,21 +3877,27 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 oldGroupPosition = linkPart.GroupPosition;
Quaternion oldRootRotation = linkPart.RotationOffset;
linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
linkPart.GroupPosition = AbsolutePosition;
//linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
//linkPart.GroupPosition = AbsolutePosition;
linkPart.SetOffsetPosition(linkPart.GroupPosition - AbsolutePosition);
linkPart.SetGroupPosition(AbsolutePosition);
Vector3 axPos = linkPart.OffsetPosition;
Quaternion parentRot = m_rootPart.RotationOffset;
axPos *= Quaternion.Inverse(parentRot);
linkPart.OffsetPosition = axPos;
//linkPart.OffsetPosition = axPos;
linkPart.SetOffsetPosition(axPos);
Quaternion oldRot = linkPart.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
linkPart.RotationOffset = newRot;
//linkPart.RotationOffset = newRot;
linkPart.SetRotationOffset(newRot);
//ParentID is only valid locally, so remote value is ignored and no syncinfo will be modified
linkPart.ParentID = m_rootPart.LocalId;
if (m_rootPart.LinkNum == 0)
m_rootPart.LinkNum = 1;
//m_rootPart.LinkNum = 1;
m_rootPart.SetLinkNum(1);
lock (m_parts.SyncRoot)
{
@ -3836,11 +3913,13 @@ namespace OpenSim.Region.Framework.Scenes
if (part.LinkNum != 1)
{
// Don't update root prim link number
part.LinkNum += objectGroup.PrimCount;
//part.LinkNum += objectGroup.PrimCount;
part.SetLinkNum(objectGroup.PrimCount);
}
}
linkPart.LinkNum = 2;
//linkPart.LinkNum = 2;
linkPart.SetLinkNum(2);
linkPart.SetParent(this);
linkPart.CreateSelected = true;
@ -3859,7 +3938,7 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectPart part = ogParts[i];
if (part.UUID != objectGroup.m_rootPart.UUID)
LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
LinkNonRootPartBySync(part, oldGroupPosition, oldRootRotation, linkNum++);
part.ClearUndoState();
}
}
@ -3877,10 +3956,59 @@ namespace OpenSim.Region.Framework.Scenes
// Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
// position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
// unmoved prims!
ResetChildPrimPhysicsPositions();
//ResetChildPrimPhysicsPositions();
//EntityBase sogBase = (EntityBase)this;
//sogBase.AbsolutePosition = AbsolutePosition;
SetAbsolutePosition(AbsolutePosition);
}
private void LinkNonRootPartBySync(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
{
Quaternion parentRot = oldGroupRotation;
Quaternion oldRot = part.RotationOffset;
Quaternion worldRot = parentRot * oldRot;
parentRot = oldGroupRotation;
Vector3 axPos = part.OffsetPosition;
axPos *= parentRot;
//part.OffsetPosition = axPos;
//part.GroupPosition = oldGroupPosition + part.OffsetPosition;
//part.OffsetPosition = Vector3.Zero;
//part.RotationOffset = worldRot;
part.SetOffsetPosition(axPos);
part.SetGroupPosition(oldGroupPosition + part.OffsetPosition);
part.SetOffsetPosition(Vector3.Zero);
part.SetRotationOffset(worldRot);
part.SetParent(this);
part.ParentID = m_rootPart.LocalId;
m_parts.Add(part.UUID, part);
//part.LinkNum = linkNum;
part.SetLinkNum(linkNum);
//part.OffsetPosition = part.GroupPosition - AbsolutePosition;
part.SetOffsetPosition(part.GroupPosition - AbsolutePosition);
Quaternion rootRotation = m_rootPart.RotationOffset;
Vector3 pos = part.OffsetPosition;
pos *= Quaternion.Inverse(rootRotation);
//part.OffsetPosition = pos;
part.SetOffsetPosition(pos);
parentRot = m_rootPart.RotationOffset;
oldRot = part.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
//part.RotationOffset = newRot;
part.SetRotationOffset(newRot);
}
/*
public void SyncInfoUpdate()
{

View File

@ -335,7 +335,24 @@ namespace OpenSim.Region.Framework.Scenes
public bool IgnoreUndoUpdate = false;
public PrimFlags LocalFlags;
//SYMMETRIC SYNC
//public PrimFlags LocalFlags;
private PrimFlags m_localFlags;
public PrimFlags LocalFlags
{
get { return m_localFlags; }
set
{
SetLocalFlags(value);
UpdateBucketSyncInfo("LocalFlags");
}
}
public void SetLocalFlags(PrimFlags value)
{
m_localFlags = value;
}
private float m_damage = -1.0f;
private byte[] m_TextureAnimation;
private byte m_clickAction;
@ -675,7 +692,9 @@ namespace OpenSim.Region.Framework.Scenes
{
get { return m_name; }
set
{
{
SetName(value);
UpdateBucketSyncInfo("Name");
/*
m_name = value;
if (PhysActor != null)
@ -1239,7 +1258,8 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetAcceleration(value);
//UpdateBucketSyncInfo("Acceleration");
UpdateBucketSyncInfo("Acceleration");
//m_acceleration = value;
}
}
@ -1255,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetDescription(value);
//UpdateBucketSyncInfo("Description");
UpdateBucketSyncInfo("Description");
/*
m_description = value;
PhysicsActor actor = PhysActor;
@ -1286,7 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetColor(value);
//UpdateBucketSyncInfo("Color");
UpdateBucketSyncInfo("Color");
//m_color = value;
/* ScheduleFullUpdate() need not be called b/c after
@ -1315,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetText(value, false);
//UpdateBucketSyncInfo("Text");
UpdateBucketSyncInfo("Text");
//m_text = value;
}
}
@ -1333,7 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetSitName(value);
//UpdateBucketSyncInfo("SitName");
UpdateBucketSyncInfo("SitName");
//m_sitName = value;
}
}
@ -1381,7 +1401,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
SetClickAction(value);
//UpdateBucketSyncInfo("ClickAction");
UpdateBucketSyncInfo("ClickAction");
//m_clickAction = value;
}
}
@ -1579,6 +1599,11 @@ namespace OpenSim.Region.Framework.Scenes
//m_sitTargetPosition = value;
}
}
//SYMMETRIC SYNC
public void SetSitTargetPositionLL(Vector3 value)
{
m_sitTargetPosition = value;
}
public Quaternion SitTargetOrientationLL
{
@ -1599,6 +1624,11 @@ namespace OpenSim.Region.Framework.Scenes
//m_sitTargetOrientation = new Quaternion(value.X, value.Y, value.Z, value.W);
}
}
//SYMMETRIC SYNC
public void SetSitTargetOrientationLL(Quaternion value)
{
m_sitTargetOrientation = value;
}
public bool Stopped
{
@ -2038,12 +2068,16 @@ namespace OpenSim.Region.Framework.Scenes
public void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
{
m_particleSystem = pSystem.GetBytes();
//SYMMETRIC SYNC
//m_particleSystem = pSystem.GetBytes();
ParticleSystem = pSystem.GetBytes();
}
public void RemoveParticleSystem()
{
m_particleSystem = new byte[0];
//SYMMETRIC SYNC
//m_particleSystem = new byte[0];
ParticleSystem = new byte[0];
}
/// Terse updates
@ -2080,7 +2114,9 @@ namespace OpenSim.Region.Framework.Scenes
Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4);
Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8);
m_TextureAnimation = data;
//m_TextureAnimation = data;
//SYMMETRIC SYNC
TextureAnimation = data;
}
public void AdjustSoundGain(double volume)
@ -3616,12 +3652,12 @@ namespace OpenSim.Region.Framework.Scenes
// Tricks physics engine into thinking we've changed the part shape.
PrimitiveBaseShape m_newshape = m_shape.Copy();
PhysActor.Shape = m_newshape;
m_shape = m_newshape;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
//SYMMETRIC SYNC
UpdateBucketSyncInfo("Shape");
//m_shape = m_newshape;
Shape = m_newshape;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
}
@ -4902,32 +4938,36 @@ namespace OpenSim.Region.Framework.Scenes
case 1:
if (god)
{
_baseMask = ApplyMask(_baseMask, set, mask);
Inventory.ApplyGodPermissions(_baseMask);
//SYMMETRIC SYNC
UpdateBucketSyncInfo("BaseMask");
//_baseMask = ApplyMask(_baseMask, set, mask);
BaseMask = ApplyMask(_baseMask, set, mask);
Inventory.ApplyGodPermissions(_baseMask);
}
break;
case 2:
_ownerMask = ApplyMask(_ownerMask, set, mask) &
baseMask;
//SYMMETRIC SYNC
UpdateBucketSyncInfo("OwnerMask");
//_ownerMask = ApplyMask(_ownerMask, set, mask) &
// baseMask;
OwnerMask = ApplyMask(_ownerMask, set, mask) & baseMask;
break;
case 4:
_groupMask = ApplyMask(_groupMask, set, mask) &
baseMask;
//SYMMETRIC SYNC
UpdateBucketSyncInfo("GroupMask");
//_groupMask = ApplyMask(_groupMask, set, mask) &
// baseMask;
GroupMask = ApplyMask(_groupMask, set, mask) &
baseMask;
break;
case 8:
_everyoneMask = ApplyMask(_everyoneMask, set, mask) &
baseMask;
//SYMMETRIC SYNC
UpdateBucketSyncInfo("EveryoneMask");
//_everyoneMask = ApplyMask(_everyoneMask, set, mask) &
// baseMask;
EveryoneMask = ApplyMask(_everyoneMask, set, mask) &
baseMask;
break;
case 16:
//SYMMETRIC SYNC
_nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) &
baseMask;
// Prevent the client from creating no mod, no copy
@ -4935,10 +4975,9 @@ namespace OpenSim.Region.Framework.Scenes
if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0)
_nextOwnerMask |= (uint)PermissionMask.Transfer;
_nextOwnerMask |= (uint)PermissionMask.Move;
//SYMMETRIC SYNC
UpdateBucketSyncInfo("NextOwnerMask");
//_nextOwnerMask |= (uint)PermissionMask.Move;
NextOwnerMask = _nextOwnerMask | (uint)PermissionMask.Move;
break;
}
@ -5664,8 +5703,8 @@ namespace OpenSim.Region.Framework.Scenes
"RotationOffset",
"Velocity",
"AngularVelocity",
//"Acceleration",
"SOP_Acceleration", //SOP and PA read/write their own local copies of acceleration, so we distinguish the copies
"Acceleration", //This is the property maintained in SOP. SOP and PA read/write their own local copies of acceleration, so we distinguish the copies
//"SOP_Acceleration", //SOP and PA read/write their own local copies of acceleration, so we distinguish the copies
"Description",
"Color",
"Text",
@ -5695,6 +5734,7 @@ namespace OpenSim.Region.Framework.Scenes
"EveryoneMask",
"NextOwnerMask",
"Flags",
"LocalFlags",
"CollisionSound",
"CollisionSoundVolume",
"MediaUrl",
@ -5853,7 +5893,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if (this.CollisionSound != updatedCollisionSound)
{
m_collisionSound = updatedCollisionSound;
//m_collisionSound = updatedCollisionSound;
SetCollisionSound(updatedCollisionSound);
return true;
}
return false;
@ -5987,21 +6028,53 @@ namespace OpenSim.Region.Framework.Scenes
SetPassTouches(updatedPart.PassTouches);
//RegionHandle skipped
SetScriptAccessPin(updatedPart.ScriptAccessPin);
//SetAcceleration(updatedPart.Acceleration);
//SetDescription(updatedPart.Description);
//SetColor(updatedPart.Color);
//SetText(updatedPart.Text);
//SetSitName(updatedPart.SitName);
SetAcceleration(updatedPart.Acceleration);
SetDescription(updatedPart.Description);
SetColor(updatedPart.Color);
SetText(updatedPart.Text);
SetSitName(updatedPart.SitName);
SetTouchName(updatedPart.TouchName);
SetLinkNum(updatedPart.LinkNum);
//SetClickAction(updatedPart.ClickAction);
SetClickAction(updatedPart.ClickAction);
SetShape(updatedPart.Shape);
//UpdateFlag skipped: It's a flag meanful locally, especially in scheduling updates to viewers.
//Only in one place will it cause updating some "last" variables (see SendScheduledUpdates).
SetSitTargetOrientation(updatedPart.SitTargetOrientation);
SetSitTargetPosition(updatedPart.SitTargetPosition);
SetSitTargetPositionLL(updatedPart.SitTargetPositionLL);
SetSitTargetOrientationLL(updatedPart.SitTargetOrientationLL);
//ParentID skipped, the value is assigned locally and only meaningful locally (LinkObjects and LinkObjectsBySync will set it appropriately)\
SetCreationDate(updatedPart.CreationDate);
SetCategory(updatedPart.Category);
SetSalePrice(updatedPart.SalePrice);
SetObjectSaleType(updatedPart.ObjectSaleType);
SetOwnershipCost(updatedPart.OwnershipCost);
SetGroupID(updatedPart.GroupID);
SetOwnerID(updatedPart.OwnerID);
SetLastOwnerID(updatedPart.LastOwnerID);
SetBaseMask(updatedPart.BaseMask);
SetOwnerMask(updatedPart.OwnerMask);
SetGroupMask(updatedPart.GroupMask);
SetEveryoneMask(updatedPart.EveryoneMask);
SetNextOwnerMask(updatedPart.NextOwnerMask);
SetFlags(updatedPart.Flags);
//Treat CollisionSound in a different way, so that if any property needs to be changed due to aggregateScriptEvents(), timestamp can be updated after
//the current copying-property-values-from-remote-sync-message is done.
bool collisionSoundUpdated = UpdateCollisionSound(updatedPart.CollisionSound);
SetCollisionSoundVolume(updatedPart.CollisionSoundVolume);
SetMediaUrl(updatedPart.MediaUrl);
SetTextureAnimation(updatedPart.TextureAnimation);
SetParticleSystem(updatedPart.ParticleSystem);
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;
if (collisionSoundUpdated)
{
//If the local actor is Script Engine, it will catch this evnet and trigger aggregateScriptEvents()
m_parentGroup.Scene.EventManager.TriggerAggregateScriptEvents(this);
}
}
}

View File

@ -330,6 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
//SYMMETRIC SYNC
m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp);
//m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID);
m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo);
@ -713,7 +714,12 @@ 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");
}
public static void ProcessBucketSyncInfo(SceneObjectPart obj, XmlTextReader reader)
{
@ -1236,8 +1242,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
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, "Flags", sop.GetEffectiveObjectFlags().ToString(), options);
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());
//end SYMMETRIC SYNC
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());