mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +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:
@@ -56,6 +56,8 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
private SqliteDataAdapter landDa;
|
||||
private SqliteDataAdapter landAccessListDa;
|
||||
|
||||
private SqliteConnection m_conn;
|
||||
|
||||
private String m_connectionString;
|
||||
|
||||
private bool persistPrimInventories;
|
||||
@@ -77,6 +79,9 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString);
|
||||
SqliteConnection conn = new SqliteConnection(m_connectionString);
|
||||
|
||||
// Arg! Hate databases..
|
||||
m_conn = conn;
|
||||
|
||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
|
||||
primDa = new SqliteDataAdapter(primSelectCmd);
|
||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
||||
@@ -564,6 +569,16 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
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"]};
|
||||
|
||||
@@ -764,6 +779,26 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
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 now has null values :P
|
||||
using (SqliteCommand cmd = new SqliteCommand("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_conn))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
@@ -889,6 +924,18 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
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)
|
||||
@@ -1331,6 +1378,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||
DataSet tmpDS = new DataSet();
|
||||
try
|
||||
{
|
||||
|
||||
pDa.Fill(tmpDS, "prims");
|
||||
sDa.Fill(tmpDS, "primshapes");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user