Implemented several SetXXXProperty functions. Set operation ("=") for these properties now first calls SetXXXProperty and then triggers UpdateBucketSyncInfo().

dsg
Huaiyu (Kitty) Liu 2011-02-03 14:24:15 -08:00
commit 3cff68340f
3 changed files with 148 additions and 17 deletions

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("{0} [Start] Could not connect to RegionSyncServer at {1}:{2}", LogHeader, m_remoteListenerInfo.Addr, m_remoteListenerInfo.Port); m_log.WarnFormat("{0} [Start] Could not connect to RegionSyncModule at {1}:{2}", LogHeader, m_remoteListenerInfo.Addr, m_remoteListenerInfo.Port);
m_log.Warn(e.Message); m_log.Warn(e.Message);
return false; return false;
} }

View File

@ -185,8 +185,9 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_allowedDrop; } get { return m_allowedDrop; }
set set
{ {
m_allowedDrop = value; //m_allowedDrop = value;
//UpdateBucketSyncInfo("AllowedDrop"); SetAllowedDrop(value);
UpdateBucketSyncInfo("AllowedDrop");
} }
} }
public void SetAllowedDrop(bool value) public void SetAllowedDrop(bool value)
@ -797,9 +798,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
set set
{ {
//SetGroupPosition(value); SetGroupPosition(value);
//UpdateBucketSyncInfo("GroupPosition"); UpdateBucketSyncInfo("GroupPosition");
/*
//Legacy Opensim code //Legacy Opensim code
m_groupPosition = value; m_groupPosition = value;
@ -841,7 +843,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
*/
} }
} }
//SYMMETRIC SYNC //SYMMETRIC SYNC
@ -895,6 +897,9 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_offsetPosition; } get { return m_offsetPosition; }
set set
{ {
SetOffsetPosition(value);
UpdateBucketSyncInfo("OffsetPosition");
/*
StoreUndoState(); StoreUndoState();
m_offsetPosition = value; m_offsetPosition = value;
@ -910,6 +915,26 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
} }
* */
}
}
//SYMMETRIC SYNC
public void SetOffsetPosition(Vector3 value)
{
StoreUndoState();
m_offsetPosition = value;
if (ParentGroup != null && !ParentGroup.IsDeleted)
{
PhysicsActor actor = PhysActor;
if (_parentID != 0 && actor != null)
{
actor.Position = GetWorldPosition();
actor.Orientation = GetWorldRotation();
// Tell the physics engines that this prim changed.
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
} }
} }
@ -951,6 +976,9 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
SetRotationOffset(value);
UpdateBucketSyncInfo("RotationOffset");
/*
StoreUndoState(); StoreUndoState();
m_rotationOffset = value; m_rotationOffset = value;
@ -980,9 +1008,43 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
} }
} }
* */
} }
} }
//SYMMETRIC SYNC
public void SetRotationOffset(Quaternion value)
{
StoreUndoState();
m_rotationOffset = value;
PhysicsActor actor = PhysActor;
if (actor != null)
{
try
{
// Root prim gets value directly
if (_parentID == 0)
{
actor.Orientation = value;
//m_log.Info("[PART]: RO1:" + actor.Orientation.ToString());
}
else
{
// Child prim we have to calculate it's world rotationwel
Quaternion resultingrotation = GetWorldRotation();
actor.Orientation = resultingrotation;
//m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
}
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
//}
}
catch (Exception ex)
{
m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
}
}
}
/// <summary></summary> /// <summary></summary>
public Vector3 Velocity public Vector3 Velocity
@ -1003,6 +1065,9 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
SetVelocity(value);
UpdateBucketSyncInfo("Velocity");
/*
m_velocity = value; m_velocity = value;
PhysicsActor actor = PhysActor; PhysicsActor actor = PhysActor;
@ -1014,6 +1079,22 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
} }
* */
}
}
//SYMMETRIC SYNC
public void SetVelocity(Vector3 value)
{
m_velocity = value;
PhysicsActor actor = PhysActor;
if (actor != null)
{
if (actor.IsPhysical)
{
actor.Velocity = value;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
} }
} }
@ -1029,7 +1110,17 @@ namespace OpenSim.Region.Framework.Scenes
} }
return m_angularVelocity; return m_angularVelocity;
} }
set { m_angularVelocity = value; } set
{
SetAngularVelocity(value);
UpdateBucketSyncInfo("AngularVelocity");
//m_angularVelocity = value;
}
}
//SYMMETRIC SYNC
public void SetAngularVelocity(Vector3 value)
{
m_angularVelocity = value;
} }
/// <summary></summary> /// <summary></summary>
@ -1125,6 +1216,34 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get { return m_shape.Scale; } get { return m_shape.Scale; }
set set
{
SetScale(value);
UpdateBucketSyncInfo("Scale");
/*
StoreUndoState();
if (m_shape != null)
{
m_shape.Scale = value;
PhysicsActor actor = PhysActor;
if (actor != null && m_parentGroup != null)
{
if (m_parentGroup.Scene != null)
{
if (m_parentGroup.Scene.PhysicsScene != null)
{
actor.Size = m_shape.Scale;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
}
}
}
TriggerScriptChangedEvent(Changed.SCALE);
* */
}
}
//SYMMETRIC SYNC
public void SetScale(Vector3 value)
{ {
StoreUndoState(); StoreUndoState();
if (m_shape != null) if (m_shape != null)
@ -1146,7 +1265,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
TriggerScriptChangedEvent(Changed.SCALE); TriggerScriptChangedEvent(Changed.SCALE);
} }
}
public byte UpdateFlag public byte UpdateFlag
{ {
@ -5418,7 +5537,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
//Should be called when the SceneObjectGroup this part is in is added to scene, see SceneObjectGroup.AttachToScene //Initialize and set the values of timestamp and actorID for each synchronization bucket.
//Should be called when the SceneObjectGroup this part is in is added to scene, see SceneObjectGroup.AttachToScene.
public void InitializeBucketSyncInfo() public void InitializeBucketSyncInfo()
{ {
if (m_primPropertyBucketMap == null) if (m_primPropertyBucketMap == null)
@ -5451,6 +5571,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Update the timestamp and actorID information of the bucket the given property belongs to.
/// </summary>
/// <param name="propertyName">Name of the property. Make sure the spelling is consistent with what are defined in PropertyList</param>
private void UpdateBucketSyncInfo(string propertyName) private void UpdateBucketSyncInfo(string propertyName)
{ {
if (m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count>0) if (m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count>0)

View File

@ -418,11 +418,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
#region SOPXmlProcessors #region SOPXmlProcessors
//SYMMETRIC SYNC NOTE: TODO -- assignments in de-serialization should directly set the values w/o triggering SceneObjectPart.UpdateBucketSyncInfo; //SYMMETRIC SYNC NOTE: -- assignments in de-serialization should directly set the values w/o triggering SceneObjectPart.UpdateBucketSyncInfo;
//That is, calling SetXXX(value) instead of "XXX = value". It's an code optimization to be done later. //That is, calling SetXXX(value) instead of using "XXX = value".
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.AllowedDrop = Util.ReadBoolean(reader); //obj.AllowedDrop = Util.ReadBoolean(reader);
obj.SetAllowedDrop(Util.ReadBoolean(reader));
} }
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
@ -487,27 +488,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); //obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
obj.SetGroupPosition(Util.ReadVector(reader, "GroupPosition"));
} }
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; //obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
obj.SetOffsetPosition(Util.ReadVector(reader, "OffsetPosition"));
} }
private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); //obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
obj.SetRotationOffset(Util.ReadQuaternion(reader, "RotationOffset"));
} }
private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.Velocity = Util.ReadVector(reader, "Velocity"); //obj.Velocity = Util.ReadVector(reader, "Velocity");
obj.SetVelocity(Util.ReadVector(reader, "Velocity"));
} }
private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); //obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
obj.SetVelocity(Util.ReadVector(reader, "AngularVelocity"));
} }
private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
@ -566,7 +572,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.Scale = Util.ReadVector(reader, "Scale"); //obj.Scale = Util.ReadVector(reader, "Scale");
obj.SetScale(Util.ReadVector(reader, "Scale"));
} }
private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader) private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)