From acea31518b00b02e2ba8b08106a76de0fbef29ab Mon Sep 17 00:00:00 2001
From: MW
Date: Fri, 17 Jul 2009 14:58:54 +0000
Subject: 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.]
---
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 19 ++++++
.../Region/Framework/Scenes/SceneObjectGroup.cs | 70 +++++++++++++++++++++-
3 files changed, 87 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 81d54e7..63cf9ce 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -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;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 62870d5..3f63481 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1207,6 +1207,25 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
+ 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);
+ }
+ }
+ }
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e987445..00ae504 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -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
@@ -3017,6 +3058,29 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
+ ///
+ 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;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
private void UpdateRootRotation(Quaternion rot)
{
Quaternion axRot = rot;
--
cgit v1.1