change SitTarget calls from functions to properties

0.6.0-stable
Sean Dague 2008-07-07 20:12:14 +00:00
parent de69ecfaae
commit 867d72c956
8 changed files with 86 additions and 102 deletions

View File

@ -932,18 +932,19 @@ namespace OpenSim.Data.MSSQL
); );
try try
{ {
prim.SetSitTargetLL(new LLVector3( prim.SitTargetPositionLL = new LLVector3(
Convert.ToSingle(row["SitTargetOffsetX"]), Convert.ToSingle(row["SitTargetOffsetX"]),
Convert.ToSingle(row["SitTargetOffsetY"]), Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( Convert.ToSingle(row["SitTargetOffsetZ"]));
Convert.ToSingle( prim.SitTargetOrientationLL = new LLQuaternion(
row["SitTargetOrientX"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientX"]),
row["SitTargetOrientY"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientY"]),
row["SitTargetOrientZ"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientZ"]),
row["SitTargetOrientW"]))); Convert.ToSingle(
row["SitTargetOrientW"]));
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -1136,12 +1137,12 @@ namespace OpenSim.Data.MSSQL
try try
{ {
// Sit target // Sit target
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); LLVector3 sitTargetPos = prim.SitTargetPositionLL;
row["SitTargetOffsetX"] = sitTargetPos.X; row["SitTargetOffsetX"] = sitTargetPos.X;
row["SitTargetOffsetY"] = sitTargetPos.Y; row["SitTargetOffsetY"] = sitTargetPos.Y;
row["SitTargetOffsetZ"] = sitTargetPos.Z; row["SitTargetOffsetZ"] = sitTargetPos.Z;
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
row["SitTargetOrientW"] = sitTargetOrient.W; row["SitTargetOrientW"] = sitTargetOrient.W;
row["SitTargetOrientX"] = sitTargetOrient.X; row["SitTargetOrientX"] = sitTargetOrient.X;
row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientY"] = sitTargetOrient.Y;

View File

@ -1314,18 +1314,19 @@ namespace OpenSim.Data.MySQL
); );
try try
{ {
prim.SetSitTargetLL(new LLVector3( prim.SitTargetPositionLL = new LLVector3(
Convert.ToSingle(row["SitTargetOffsetX"]), Convert.ToSingle(row["SitTargetOffsetX"]),
Convert.ToSingle(row["SitTargetOffsetY"]), Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( Convert.ToSingle(row["SitTargetOffsetZ"]));
Convert.ToSingle( prim.SitTargetOrientationLL = new LLQuaternion(
row["SitTargetOrientX"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientX"]),
row["SitTargetOrientY"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientY"]),
row["SitTargetOrientZ"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientZ"]),
row["SitTargetOrientW"]))); Convert.ToSingle(
row["SitTargetOrientW"]));
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -1584,12 +1585,12 @@ namespace OpenSim.Data.MySQL
try try
{ {
// Sit target // Sit target
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); LLVector3 sitTargetPos = prim.SitTargetPositionLL;
row["SitTargetOffsetX"] = sitTargetPos.X; row["SitTargetOffsetX"] = sitTargetPos.X;
row["SitTargetOffsetY"] = sitTargetPos.Y; row["SitTargetOffsetY"] = sitTargetPos.Y;
row["SitTargetOffsetZ"] = sitTargetPos.Z; row["SitTargetOffsetZ"] = sitTargetPos.Z;
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
row["SitTargetOrientW"] = sitTargetOrient.W; row["SitTargetOrientW"] = sitTargetOrient.W;
row["SitTargetOrientX"] = sitTargetOrient.X; row["SitTargetOrientX"] = sitTargetOrient.X;
row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientY"] = sitTargetOrient.Y;

View File

@ -992,18 +992,19 @@ namespace OpenSim.Data.SQLite
try try
{ {
prim.SetSitTargetLL(new LLVector3( prim.SitTargetPositionLL = new LLVector3(
Convert.ToSingle(row["SitTargetOffsetX"]), Convert.ToSingle(row["SitTargetOffsetX"]),
Convert.ToSingle(row["SitTargetOffsetY"]), Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( Convert.ToSingle(row["SitTargetOffsetZ"]));
Convert.ToSingle( prim.SitTargetOrientationLL = new LLQuaternion(
row["SitTargetOrientX"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientX"]),
row["SitTargetOrientY"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientY"]),
row["SitTargetOrientZ"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientZ"]),
row["SitTargetOrientW"]))); Convert.ToSingle(
row["SitTargetOrientW"]));
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -1334,12 +1335,12 @@ namespace OpenSim.Data.SQLite
row["RotationW"] = prim.RotationOffset.W; row["RotationW"] = prim.RotationOffset.W;
// Sit target // Sit target
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); LLVector3 sitTargetPos = prim.SitTargetPositionLL;
row["SitTargetOffsetX"] = sitTargetPos.X; row["SitTargetOffsetX"] = sitTargetPos.X;
row["SitTargetOffsetY"] = sitTargetPos.Y; row["SitTargetOffsetY"] = sitTargetPos.Y;
row["SitTargetOffsetZ"] = sitTargetPos.Z; row["SitTargetOffsetZ"] = sitTargetPos.Z;
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
row["SitTargetOrientW"] = sitTargetOrient.W; row["SitTargetOrientW"] = sitTargetOrient.W;
row["SitTargetOrientX"] = sitTargetOrient.X; row["SitTargetOrientX"] = sitTargetOrient.X;
row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientY"] = sitTargetOrient.Y;

View File

@ -1508,28 +1508,6 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero; return LLUUID.Zero;
} }
public Quaternion GetSitTargetOrientation()
{
return m_sitTargetOrientation;
}
public LLQuaternion GetSitTargetOrientationLL()
{
return
new LLQuaternion(m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,
m_sitTargetOrientation.w);
}
public Vector3 GetSitTargetPosition()
{
return m_sitTargetPosition;
}
public LLVector3 GetSitTargetPositionLL()
{
return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y, m_sitTargetPosition.z);
}
/// <summary> /// <summary>
/// Method for a prim to get it's world position from the group. /// Method for a prim to get it's world position from the group.
/// Remember, the Group Position simply gives the position of the group itself /// Remember, the Group Position simply gives the position of the group itself
@ -2382,23 +2360,23 @@ namespace OpenSim.Region.Environment.Scenes
aggregateScriptEvents(); aggregateScriptEvents();
} }
public void SetSitTarget(Vector3 offset, Quaternion orientation) // public void SetSitTarget(Vector3 offset, Quaternion orientation)
{ // {
m_sitTargetPosition = offset; // m_sitTargetPosition = offset;
m_sitTargetOrientation = orientation; // m_sitTargetOrientation = orientation;
} // }
// Utility function so the databases don't have to reference axiom.math // // Utility function so the databases don't have to reference axiom.math
public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation) // public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
{ // {
if ( // if (
!(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) && // !(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) &&
orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0)) // orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0))
{ // {
m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z); // m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z); // m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
} // }
} // }
/// <summary> /// <summary>
/// Set the text displayed for this part. /// Set the text displayed for this part.

View File

@ -1096,8 +1096,8 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in partArray) foreach (SceneObjectPart part in partArray)
{ {
// Is a sit target available? // Is a sit target available?
Vector3 avSitOffSet = part.GetSitTargetPosition(); Vector3 avSitOffSet = part.SitTargetPosition;
Quaternion avSitOrientation = part.GetSitTargetOrientation(); Quaternion avSitOrientation = part.SitTargetOrientation;
LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget(); LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget();
bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero)); bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero));
@ -1130,8 +1130,8 @@ namespace OpenSim.Region.Environment.Scenes
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
// Is a sit target available? // Is a sit target available?
Vector3 avSitOffSet = part.GetSitTargetPosition(); Vector3 avSitOffSet = part.SitTargetPosition;
Quaternion avSitOrientation = part.GetSitTargetOrientation(); Quaternion avSitOrientation = part.SitTargetOrientation;
LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget(); LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget();
bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero)); bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero));
@ -1222,8 +1222,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (part.GetAvatarOnSitTarget() == UUID) if (part.GetAvatarOnSitTarget() == UUID)
{ {
Vector3 sitTargetPos = part.GetSitTargetPosition(); Vector3 sitTargetPos = part.SitTargetPosition;
Quaternion sitTargetOrient = part.GetSitTargetOrientation(); Quaternion sitTargetOrient = part.SitTargetOrientation;
//Quaternion vq = new Quaternion(sitTargetPos.x, sitTargetPos.y+0.2f, sitTargetPos.z+0.2f, 0); //Quaternion vq = new Quaternion(sitTargetPos.x, sitTargetPos.y+0.2f, sitTargetPos.z+0.2f, 0);
//Quaternion nq = new Quaternion(sitTargetOrient.w, -sitTargetOrient.x, -sitTargetOrient.y, -sitTargetOrient.z); //Quaternion nq = new Quaternion(sitTargetOrient.w, -sitTargetOrient.x, -sitTargetOrient.y, -sitTargetOrient.z);

View File

@ -4494,7 +4494,8 @@ namespace OpenSim.Region.ScriptEngine.Common
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
m_host.SetSitTarget(new Vector3((float)offset.x, (float)offset.y, (float)offset.z), new Quaternion((float)rot.s, (float)rot.x, (float)rot.y, (float)rot.z)); m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
m_host.SitTargetOrientation = new Quaternion((float)rot.s, (float)rot.x, (float)rot.y, (float)rot.z);
} }
public string llAvatarOnSitTarget() public string llAvatarOnSitTarget()

View File

@ -4369,7 +4369,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
m_host.SetSitTarget(new Vector3((float)offset.x, (float)offset.y, (float)offset.z), new Quaternion((float)rot.s, (float)rot.x, (float)rot.y, (float)rot.z)); m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
m_host.SitTargetOrientation = new Quaternion((float)rot.s, (float)rot.x, (float)rot.y, (float)rot.z);
} }
public string llAvatarOnSitTarget() public string llAvatarOnSitTarget()

View File

@ -557,18 +557,19 @@ namespace OpenSim.DataStore.MSSQL
try try
{ {
prim.SetSitTargetLL(new LLVector3( prim.SitTargetPositionLL = new LLVector3(
Convert.ToSingle(row["SitTargetOffsetX"]), Convert.ToSingle(row["SitTargetOffsetX"]),
Convert.ToSingle(row["SitTargetOffsetY"]), Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( Convert.ToSingle(row["SitTargetOffsetZ"]));
Convert.ToSingle( prim.SitTargetOrientationLL = new LLQuaternion(
row["SitTargetOrientX"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientX"]),
row["SitTargetOrientY"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientY"]),
row["SitTargetOrientZ"]), Convert.ToSingle(
Convert.ToSingle( row["SitTargetOrientZ"]),
row["SitTargetOrientW"]))); Convert.ToSingle(
row["SitTargetOrientW"]));
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -628,12 +629,12 @@ namespace OpenSim.DataStore.MSSQL
try try
{ {
// Sit target // Sit target
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); LLVector3 sitTargetPos = prim.SitTargetPositionLL;
row["SitTargetOffsetX"] = sitTargetPos.X; row["SitTargetOffsetX"] = sitTargetPos.X;
row["SitTargetOffsetY"] = sitTargetPos.Y; row["SitTargetOffsetY"] = sitTargetPos.Y;
row["SitTargetOffsetZ"] = sitTargetPos.Z; row["SitTargetOffsetZ"] = sitTargetPos.Z;
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
row["SitTargetOrientW"] = sitTargetOrient.W; row["SitTargetOrientW"] = sitTargetOrient.W;
row["SitTargetOrientX"] = sitTargetOrient.X; row["SitTargetOrientX"] = sitTargetOrient.X;
row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientY"] = sitTargetOrient.Y;