Fixing race conditions in the SceneObjectPart properties
parent
67ac9881fa
commit
0e8b5c7ffa
|
@ -507,21 +507,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// If this is a linkset, we don't want the physics engine mucking up our group position here.
|
// If this is a linkset, we don't want the physics engine mucking up our group position here.
|
||||||
if (PhysActor != null && _parentID == 0)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null && _parentID == 0)
|
||||||
{
|
{
|
||||||
m_groupPosition.X = PhysActor.Position.X;
|
m_groupPosition = actor.Position;
|
||||||
m_groupPosition.Y = PhysActor.Position.Y;
|
|
||||||
m_groupPosition.Z = PhysActor.Position.Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAttachment)
|
if (IsAttachment)
|
||||||
{
|
{
|
||||||
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
|
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
|
||||||
return sp.AbsolutePosition;
|
return sp.AbsolutePosition;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return m_groupPosition;
|
return m_groupPosition;
|
||||||
}
|
}
|
||||||
|
@ -531,26 +528,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_groupPosition = value;
|
m_groupPosition = value;
|
||||||
|
|
||||||
if (PhysActor != null)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Root prim actually goes at Position
|
// Root prim actually goes at Position
|
||||||
if (_parentID == 0)
|
if (_parentID == 0)
|
||||||
{
|
{
|
||||||
PhysActor.Position = value;
|
actor.Position = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// To move the child prim in respect to the group position and rotation we have to calculate
|
// To move the child prim in respect to the group position and rotation we have to calculate
|
||||||
Vector3 resultingposition = GetWorldPosition();
|
actor.Position = GetWorldPosition();
|
||||||
PhysActor.Position = resultingposition;
|
actor.Orientation = GetWorldRotation();
|
||||||
Quaternion resultingrot = GetWorldRotation();
|
|
||||||
PhysActor.Orientation = resultingrot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the physics engines that this prim changed.
|
// Tell the physics engines that this prim changed.
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -583,15 +579,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (ParentGroup != null && !ParentGroup.IsDeleted)
|
if (ParentGroup != null && !ParentGroup.IsDeleted)
|
||||||
{
|
{
|
||||||
if (_parentID != 0 && PhysActor != null)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (_parentID != 0 && actor != null)
|
||||||
{
|
{
|
||||||
Vector3 resultingposition = GetWorldPosition();
|
actor.Position = GetWorldPosition();
|
||||||
PhysActor.Position = resultingposition;
|
actor.Orientation = GetWorldRotation();
|
||||||
Quaternion resultingrot = GetWorldRotation();
|
|
||||||
PhysActor.Orientation = resultingrot;
|
|
||||||
|
|
||||||
// Tell the physics engines that this prim changed.
|
// Tell the physics engines that this prim changed.
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -602,12 +597,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// We don't want the physics engine mucking up the rotations in a linkset
|
// We don't want the physics engine mucking up the rotations in a linkset
|
||||||
if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null))
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (_parentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null)
|
||||||
{
|
{
|
||||||
if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0
|
if (actor.Orientation.X != 0f || actor.Orientation.Y != 0f
|
||||||
|| PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0)
|
|| actor.Orientation.Z != 0f || actor.Orientation.W != 0f)
|
||||||
{
|
{
|
||||||
m_rotationOffset = PhysActor.Orientation;
|
m_rotationOffset = actor.Orientation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,24 +615,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StoreUndoState();
|
StoreUndoState();
|
||||||
m_rotationOffset = value;
|
m_rotationOffset = value;
|
||||||
|
|
||||||
if (PhysActor != null)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Root prim gets value directly
|
// Root prim gets value directly
|
||||||
if (_parentID == 0)
|
if (_parentID == 0)
|
||||||
{
|
{
|
||||||
PhysActor.Orientation = value;
|
actor.Orientation = value;
|
||||||
//m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString());
|
//m_log.Info("[PART]: RO1:" + actor.Orientation.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Child prim we have to calculate it's world rotationwel
|
// Child prim we have to calculate it's world rotationwel
|
||||||
Quaternion resultingrotation = GetWorldRotation();
|
Quaternion resultingrotation = GetWorldRotation();
|
||||||
PhysActor.Orientation = resultingrotation;
|
actor.Orientation = resultingrotation;
|
||||||
//m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString());
|
//m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
|
||||||
}
|
}
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -653,16 +650,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
//if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0
|
PhysicsActor actor = PhysActor;
|
||||||
//|| PhysActor.Velocity.Z != 0)
|
if (actor != null)
|
||||||
//{
|
|
||||||
if (PhysActor != null)
|
|
||||||
{
|
{
|
||||||
if (PhysActor.IsPhysical)
|
if (actor.IsPhysical)
|
||||||
{
|
{
|
||||||
m_velocity.X = PhysActor.Velocity.X;
|
m_velocity = actor.Velocity;
|
||||||
m_velocity.Y = PhysActor.Velocity.Y;
|
|
||||||
m_velocity.Z = PhysActor.Velocity.Z;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,12 +665,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_velocity = value;
|
m_velocity = value;
|
||||||
if (PhysActor != null)
|
|
||||||
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null)
|
||||||
{
|
{
|
||||||
if (PhysActor.IsPhysical)
|
if (actor.IsPhysical)
|
||||||
{
|
{
|
||||||
PhysActor.Velocity = value;
|
actor.Velocity = value;
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,9 +683,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if ((PhysActor != null) && PhysActor.IsPhysical)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if ((actor != null) && actor.IsPhysical)
|
||||||
{
|
{
|
||||||
m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0);
|
m_angularVelocity = actor.RotationalVelocity;
|
||||||
}
|
}
|
||||||
return m_angularVelocity;
|
return m_angularVelocity;
|
||||||
}
|
}
|
||||||
|
@ -710,9 +706,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_description = value;
|
m_description = value;
|
||||||
if (PhysActor != null)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null)
|
||||||
{
|
{
|
||||||
PhysActor.SOPDescription = value;
|
actor.SOPDescription = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,17 +800,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState();
|
||||||
if (m_shape != null) {
|
if (m_shape != null)
|
||||||
|
{
|
||||||
m_shape.Scale = value;
|
m_shape.Scale = value;
|
||||||
|
|
||||||
if (PhysActor != null && m_parentGroup != null)
|
PhysicsActor actor = PhysActor;
|
||||||
|
if (actor != null && m_parentGroup != null)
|
||||||
{
|
{
|
||||||
if (m_parentGroup.Scene != null)
|
if (m_parentGroup.Scene != null)
|
||||||
{
|
{
|
||||||
if (m_parentGroup.Scene.PhysicsScene != null)
|
if (m_parentGroup.Scene.PhysicsScene != null)
|
||||||
{
|
{
|
||||||
PhysActor.Size = m_shape.Scale;
|
actor.Size = m_shape.Scale;
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1051,8 +1050,6 @@ if (m_shape != null) {
|
||||||
|
|
||||||
#endregion Public Properties with only Get
|
#endregion Public Properties with only Get
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private uint ApplyMask(uint val, bool set, uint mask)
|
private uint ApplyMask(uint val, bool set, uint mask)
|
||||||
|
|
Loading…
Reference in New Issue