mirror of
https://github.com/opensim/opensim.git
synced 2026-05-18 22:25:36 +08:00
* Added Sit Target persistence over sim restarts for mySQL and MonoSQLite.
* SAVE YOUR PRIM DATA, THIS MAKES CHANGES TO YOUR PRIMS TABLE * The first time you run OpenSim after updating past this revision, you'll see a lot of Errors. Be calm, shutdown the simulator, and start it again and your prims table will be updated. * MSSQL added the fields to the Initial CreateTable section, however, you'll need to add the fields to your prims table if you want it to persist.
This commit is contained in:
@@ -523,6 +523,16 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
createCol(prims, "RotationY", typeof(Double));
|
||||
createCol(prims, "RotationZ", typeof(Double));
|
||||
createCol(prims, "RotationW", typeof(Double));
|
||||
// sit target
|
||||
createCol(prims, "SitTargetOffsetX", typeof(Double));
|
||||
createCol(prims, "SitTargetOffsetY", typeof(Double));
|
||||
createCol(prims, "SitTargetOffsetZ", typeof(Double));
|
||||
|
||||
createCol(prims, "SitTargetOrientW", typeof(Double));
|
||||
createCol(prims, "SitTargetOrientX", typeof(Double));
|
||||
createCol(prims, "SitTargetOrientY", typeof(Double));
|
||||
createCol(prims, "SitTargetOrientZ", typeof(Double));
|
||||
|
||||
|
||||
// Add in contraints
|
||||
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
|
||||
@@ -688,7 +698,26 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Convert.ToSingle(row["RotationZ"]),
|
||||
Convert.ToSingle(row["RotationW"])
|
||||
);
|
||||
try
|
||||
{
|
||||
prim.SetSitTargetLL(new LLVector3(
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
|
||||
Convert.ToSingle(row["SitTargetOrientW"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"])));
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
// Database table was created before we got here and needs to be created! :P
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
return prim;
|
||||
}
|
||||
|
||||
@@ -798,6 +827,19 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
row["RotationY"] = prim.RotationOffset.Y;
|
||||
row["RotationZ"] = prim.RotationOffset.Z;
|
||||
row["RotationW"] = prim.RotationOffset.W;
|
||||
|
||||
// Sit target
|
||||
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
|
||||
row["SitTargetOffsetX"] = sitTargetPos.X;
|
||||
row["SitTargetOffsetY"] = sitTargetPos.Y;
|
||||
row["SitTargetOffsetZ"] = sitTargetPos.Z;
|
||||
|
||||
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
|
||||
row["SitTargetOrientW"] = sitTargetOrient.W;
|
||||
row["SitTargetOrientX"] = sitTargetOrient.X;
|
||||
row["SitTargetOrientY"] = sitTargetOrient.Y;
|
||||
row["SitTargetOrientZ"] = sitTargetOrient.Z;
|
||||
|
||||
}
|
||||
|
||||
private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
|
||||
|
||||
Reference in New Issue
Block a user