fixed the bug where changing the rotation of a selection of prims in a linkset, made each of those prims rotate around its own centre rather than around the geometric centre of the selection like they should do (and like the client expects).

This involved adding a new OnUpdatePrimSingleRotationPosition event to IClientAPI so that we can get the changed position from the client. 
Btw adding new events to IClientAPI is really tedious where you have to copy the change across to at least 5 or 6 other files. 
[Note this doesn't fix the bug where any rotation changes to the root prim (but not the whole linkset) cause rotation errors on the child prims.]
trunk
MW 2009-07-17 14:58:54 +00:00
parent f74622c65f
commit acea31518b
11 changed files with 109 additions and 12 deletions

View File

@ -624,6 +624,7 @@ namespace OpenSim.Client.MXP.ClientStack
public event UpdateVector OnUpdatePrimGroupPosition;
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;

View File

@ -272,6 +272,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
public event UpdateVector OnUpdatePrimSinglePosition = delegate { };
public event UpdatePrimRotation OnUpdatePrimGroupRotation = delegate { };
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation = delegate { };
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition = delegate { };
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation = delegate { };
public event UpdateVector OnUpdatePrimScale = delegate { };
public event UpdateVector OnUpdatePrimGroupScale = delegate { };

View File

@ -129,6 +129,8 @@ namespace OpenSim.Framework
public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient);
public delegate void UpdatePrimSingleRotationPosition( uint localID, Quaternion rot, Vector3 pos, IClientAPI remoteClient);
public delegate void UpdatePrimGroupRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient);
public delegate void ObjectDuplicate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID, UUID GroupID);
@ -633,6 +635,7 @@ namespace OpenSim.Framework
event UpdateVector OnUpdatePrimSinglePosition;
event UpdatePrimRotation OnUpdatePrimGroupRotation;
event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
event UpdateVector OnUpdatePrimScale;
event UpdateVector OnUpdatePrimGroupScale;

View File

@ -267,6 +267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private UpdateVector handlerUpdatePrimSinglePosition; //OnUpdatePrimSinglePosition;
private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation; //OnUpdatePrimSingleRotation;
private UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition; //OnUpdatePrimSingleRotation;
private UpdateVector handlerUpdatePrimScale; //OnUpdatePrimScale;
private UpdateVector handlerUpdatePrimGroupScale; //OnUpdateGroupScale;
private UpdateVector handlerUpdateVector; //OnUpdatePrimGroupPosition;
@ -1095,6 +1096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;
@ -4481,18 +4483,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation;
if (handlerUpdatePrimSingleRotation != null)
{
//m_log.Debug("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
// m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
handlerUpdatePrimSingleRotation(localId, rot1, this);
}
break;
case 3:
Vector3 rotPos = new Vector3(block.Data, 0);
Quaternion rot2 = new Quaternion(block.Data, 12, true);
handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation;
if (handlerUpdatePrimSingleRotation != null)
handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition;
if (handlerUpdatePrimSingleRotationPosition != null)
{
//m_log.Debug("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
handlerUpdatePrimSingleRotation(localId, rot2, this);
// m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
// m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
}
break;
case 4:
@ -4541,7 +4545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
if (handlerUpdatePrimRotation != null)
{
// Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
// Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
handlerUpdatePrimRotation(localId, rot3, this);
}
break;
@ -4552,8 +4556,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation;
if (handlerUpdatePrimGroupRotation != null)
{
//m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
// m_log.Debug("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
// m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
// m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
}
break;

View File

@ -117,6 +117,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event UpdateVector OnUpdatePrimGroupPosition;
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;

View File

@ -1964,6 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation;
client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation;
client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition;
client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale;
client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;

View File

@ -1201,6 +1201,25 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
///
/// </summary>
/// <param name="localID"></param>
/// <param name="rot"></param>
/// <param name="remoteClient"></param>
protected internal void UpdatePrimSingleRotationPosition(uint localID, Quaternion rot, Vector3 pos, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
{
group.UpdateSingleRotation(rot,pos, localID);
}
}
}
/// <summary>
///
/// </summary>

View File

@ -625,6 +625,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 backBottomLeft;
Vector3 backBottomRight;
// Vector3[] corners = new Vector3[8];
Vector3 orig = Vector3.Zero;
frontTopLeft.X = orig.X - (part.Scale.X / 2);
@ -660,6 +662,36 @@ namespace OpenSim.Region.Framework.Scenes
backBottomRight.Y = orig.Y + (part.Scale.Y / 2);
backBottomRight.Z = orig.Z - (part.Scale.Z / 2);
//m_log.InfoFormat("pre corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
//m_log.InfoFormat("pre corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
//m_log.InfoFormat("pre corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
//m_log.InfoFormat("pre corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
//m_log.InfoFormat("pre corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
//m_log.InfoFormat("pre corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
//m_log.InfoFormat("pre corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
//m_log.InfoFormat("pre corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
//for (int i = 0; i < 8; i++)
//{
// corners[i] = corners[i] * worldRot;
// corners[i] += offset;
// if (corners[i].X > maxX)
// maxX = corners[i].X;
// if (corners[i].X < minX)
// minX = corners[i].X;
// if (corners[i].Y > maxY)
// maxY = corners[i].Y;
// if (corners[i].Y < minY)
// minY = corners[i].Y;
// if (corners[i].Z > maxZ)
// maxZ = corners[i].Y;
// if (corners[i].Z < minZ)
// minZ = corners[i].Z;
//}
frontTopLeft = frontTopLeft * worldRot;
frontTopRight = frontTopRight * worldRot;
frontBottomLeft = frontBottomLeft * worldRot;
@ -681,6 +713,15 @@ namespace OpenSim.Region.Framework.Scenes
backTopLeft += offset;
backTopRight += offset;
//m_log.InfoFormat("corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
//m_log.InfoFormat("corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
//m_log.InfoFormat("corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
//m_log.InfoFormat("corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
//m_log.InfoFormat("corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
//m_log.InfoFormat("corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
//m_log.InfoFormat("corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
//m_log.InfoFormat("corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
if (frontTopRight.X > maxX)
maxX = frontTopRight.X;
if (frontTopLeft.X > maxX)
@ -801,15 +842,15 @@ namespace OpenSim.Region.Framework.Scenes
if (lower > maxZ)
{
offsetHeight = lower - (boundingBox.Z / 2);
}
else if (maxZ > lower)
{
offsetHeight = maxZ - (boundingBox.Z / 2);
offsetHeight *= -1;
}
// m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z);
// m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z);
return boundingBox;
}
#endregion
@ -3013,6 +3054,29 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
///
/// </summary>
/// <param name="rot"></param>
/// <param name="localID"></param>
public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID)
{
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
if (part.UUID == m_rootPart.UUID)
{
UpdateRootRotation(rot);
AbsolutePosition = pos;
}
else
{
part.UpdateRotation(rot);
part.OffsetPosition = pos;
}
}
}
/// <summary>
///
/// </summary>

View File

@ -699,6 +699,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;

View File

@ -223,6 +223,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event UpdateVector OnUpdatePrimGroupPosition;
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;

View File

@ -130,6 +130,7 @@ namespace OpenSim.Tests.Common.Mock
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;