From dfd60d6f71514f03386a0b97988a63e88001a86a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 20 Oct 2015 15:37:43 +0100 Subject: [PATCH] STATUS_ROTATE are linkset flags and not prim --- .../Framework/Scenes/SceneObjectGroup.cs | 29 ++++++++++++------- .../Framework/Scenes/SceneObjectPart.cs | 9 ++---- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a4a33a4e16..48fce3d48c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -4363,17 +4363,9 @@ namespace OpenSim.Region.Framework.Scenes internal void SetAxisRotation(int axis, int rotate10) { - bool setX = false; - bool setY = false; - bool setZ = false; - - int xaxis = 2; - int yaxis = 4; - int zaxis = 8; - - setX = ((axis & xaxis) != 0) ? true : false; - setY = ((axis & yaxis) != 0) ? true : false; - setZ = ((axis & zaxis) != 0) ? true : false; + bool setX = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0); + bool setY = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0); + bool setZ = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0); float setval = (rotate10 > 0) ? 1f : 0f; @@ -4388,6 +4380,21 @@ namespace OpenSim.Region.Framework.Scenes RootPart.SetPhysicsAxisRotation(); } + public int GetAxisRotation(int axis) + { + Vector3 rotAxis = RootPart.RotationAxis; + + // if multiple return the one with higher id + if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) + return (int)rotAxis.Z; + if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) + return (int)rotAxis.Y; + if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) + return (int)rotAxis.X; + + return 0; + } + public int registerRotTargetWaypoint(Quaternion target, float tolerance) { scriptRotTarget waypoint = new scriptRotTarget(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 43d522aa12..0ea4ab8d3b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2516,13 +2516,8 @@ namespace OpenSim.Region.Framework.Scenes public int GetAxisRotation(int axis) { - //Cannot use ScriptBaseClass constants as no referance to it currently. - if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) - return STATUS_ROTATE_X; - if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) - return STATUS_ROTATE_Y; - if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) - return STATUS_ROTATE_Z; + if (!ParentGroup.IsDeleted) + return ParentGroup.GetAxisRotation(axis); return 0; }