cosmetics; remove old unused sop rotation axis ints

This commit is contained in:
UbitUmarov
2024-02-15 18:48:00 +00:00
parent cc3adba92a
commit dd58a3a57c
4 changed files with 119 additions and 170 deletions

View File

@@ -4753,45 +4753,41 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
internal void SetAxisRotation(int axis, int rotate10)
public void SetAxisRotation(int axis, int rotate10)
{
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);
if((axis & (int)(axisSelect.STATUS_ROTATE_X | axisSelect.STATUS_ROTATE_Y | axisSelect.STATUS_ROTATE_Z)) == 0)
return;
if (setX || setY || setZ)
bool lockaxis = rotate10 == 0; // zero means axis locked
byte locks = RootPart.RotationAxisLocks;
if ((axis & (int)axisSelect.STATUS_ROTATE_X) != 0)
{
bool lockaxis = (rotate10 == 0); // zero means axis locked
if (lockaxis)
locks |= (byte)axisSelect.STATUS_ROTATE_X;
else
locks &= (byte)axisSelect.NOT_STATUS_ROTATE_X;
}
byte locks = RootPart.RotationAxisLocks;
if ((axis & (int)axisSelect.STATUS_ROTATE_Y) != 0)
{
if (lockaxis)
locks |= (byte)axisSelect.STATUS_ROTATE_Y;
else
locks &= (byte)axisSelect.NOT_STATUS_ROTATE_Y;
}
if (setX)
{
if(lockaxis)
locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X;
else
locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_X;
}
if ((axis & (int)axisSelect.STATUS_ROTATE_Z) != 0)
{
if (lockaxis)
locks |= (byte)axisSelect.STATUS_ROTATE_Z;
else
locks &= (byte)axisSelect.NOT_STATUS_ROTATE_Z;
}
if (setY)
{
if(lockaxis)
locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y;
else
locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Y;
}
if (setZ)
{
if(lockaxis)
locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z;
else
locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Z;
}
RootPart.RotationAxisLocks = locks;
RootPart.SetPhysicsAxisRotation();
}
RootPart.RotationAxisLocks = locks;
RootPart.SetPhysicsAxisRotation();
}
public int GetAxisRotation(int axis)
@@ -4799,11 +4795,11 @@ namespace OpenSim.Region.Framework.Scenes
byte rotAxislocks = RootPart.RotationAxisLocks;
// if multiple return the one with higher id
if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) == 0 ? 1:0;
if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) == 0 ? 1:0;
if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
if (axis == (int)axisSelect.STATUS_ROTATE_Z)
return (rotAxislocks & (byte)axisSelect.STATUS_ROTATE_Z) == 0 ? 1:0;
if (axis == (int)axisSelect.STATUS_ROTATE_Y)
return (rotAxislocks & (byte)axisSelect.STATUS_ROTATE_Y) == 0 ? 1:0;
if (axis == (int)axisSelect.STATUS_ROTATE_X)
return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) == 0 ? 1:0;
return 0;

View File

@@ -220,15 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore]
public Quaternion AttachRotation = Quaternion.Identity;
[XmlIgnore]
public int STATUS_ROTATE_X; // this should not be used
[XmlIgnore]
public int STATUS_ROTATE_Y; // this should not be used
[XmlIgnore]
public int STATUS_ROTATE_Z; // this should not be used
private int m_CollisionFilterType = 0; // -1 not in use, 0 accept false, 1 accept true
private string m_CollisionFilterString = string.Empty;
@@ -3499,16 +3490,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SetAxisRotation(int axis, int rotate)
{
ParentGroup.SetAxisRotation(axis, rotate);
//Cannot use ScriptBaseClass constants as no referance to it currently.
if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
STATUS_ROTATE_X = rotate;
if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
STATUS_ROTATE_Y = rotate;
if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
STATUS_ROTATE_Z = rotate;
}
public void SetBuoyancy(float fvalue)

View File

@@ -1636,7 +1636,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
sop.PhysicsInertia?.ToXml2(writer);
if(sop.RotationAxisLocks != 0)
if(sop.IsRoot && sop.RotationAxisLocks != 0)
writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
if (sop.Density != 1000.0f)