From 490ac0be005a989c86ebde62aad137fd2da7cbd8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 8 Sep 2008 02:40:20 +0000 Subject: Implement proper persistence of the following prim properties: Floating text, Rotation, Texture animation, Particle System This will make "Eye Candy" scripts work without modification in XEngine. The use of the CHANGED_REGION_RESTART hack is no longer needed. Implemented in MySQL only, hovertext also in SQLite. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 20 +++++++++++++++++--- OpenSim/Data/MySQL/Resources/017_RegionStore.sql | 9 +++++++++ OpenSim/Data/SQLite/Resources/009_RegionStore.sql | 8 ++++++++ OpenSim/Data/SQLite/SQLiteRegionData.cs | 9 +++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/017_RegionStore.sql create mode 100644 OpenSim/Data/SQLite/Resources/009_RegionStore.sql (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 9552ba1..b7fc70b 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -31,6 +31,7 @@ using System.Data; using System.IO; using System.Reflection; using System.Threading; +using System.Drawing; using OpenMetaverse; using log4net; using MySql.Data.MySqlClient; @@ -858,6 +859,10 @@ namespace OpenSim.Data.MySQL createCol(prims, "SceneGroupID", typeof (String)); // various text fields createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); createCol(prims, "Description", typeof (String)); createCol(prims, "SitName", typeof (String)); createCol(prims, "TouchName", typeof (String)); @@ -912,6 +917,7 @@ namespace OpenSim.Data.MySQL createCol(prims, "LoopedSound", typeof(String)); createCol(prims, "LoopedSoundGain", typeof(Double)); createCol(prims, "TextureAnimation", typeof(Byte[])); + createCol(prims, "ParticleSystem", typeof(Byte[])); createCol(prims, "OmegaX", typeof (Double)); createCol(prims, "OmegaY", typeof (Double)); @@ -1109,6 +1115,10 @@ namespace OpenSim.Data.MySQL prim.Name = (String) row["Name"]; // various text fields prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); prim.Description = (String) row["Description"]; prim.SitName = (String) row["SitName"]; prim.TouchName = (String) row["TouchName"]; @@ -1180,6 +1190,8 @@ namespace OpenSim.Data.MySQL if (!row.IsNull("TextureAnimation")) prim.TextureAnimation = (Byte[])row["TextureAnimation"]; + if (!row.IsNull("ParticleSystem")) + prim.ParticleSystem = (Byte[])row["ParticleSystem"]; prim.RotationalVelocity = new Vector3( Convert.ToSingle(row["OmegaX"]), @@ -1187,9 +1199,6 @@ namespace OpenSim.Data.MySQL Convert.ToSingle(row["OmegaZ"]) ); - // TODO: Rotation - // OmegaX, OmegaY, OmegaZ - prim.SetCameraEyeOffset(new Vector3( Convert.ToSingle(row["CameraEyeOffsetX"]), Convert.ToSingle(row["CameraEyeOffsetY"]), @@ -1419,6 +1428,10 @@ namespace OpenSim.Data.MySQL // the UUID of the root part for this SceneObjectGroup // various text fields row["Text"] = prim.Text; + row["ColorR"] = prim.Color.R; + row["ColorG"] = prim.Color.G; + row["ColorB"] = prim.Color.B; + row["ColorA"] = prim.Color.A; row["Description"] = prim.Description; row["SitName"] = prim.SitName; row["TouchName"] = prim.TouchName; @@ -1485,6 +1498,7 @@ namespace OpenSim.Data.MySQL } row["TextureAnimation"] = prim.TextureAnimation; + row["ParticleSystem"] = prim.ParticleSystem; row["OmegaX"] = prim.RotationalVelocity.X; row["OmegaY"] = prim.RotationalVelocity.Y; diff --git a/OpenSim/Data/MySQL/Resources/017_RegionStore.sql b/OpenSim/Data/MySQL/Resources/017_RegionStore.sql new file mode 100644 index 0000000..0304f30 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/017_RegionStore.sql @@ -0,0 +1,9 @@ +BEGIN; + +ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; +ALTER TABLE prims ADD COLUMN ParticleSystem blob; + +COMMIT; diff --git a/OpenSim/Data/SQLite/Resources/009_RegionStore.sql b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql new file mode 100644 index 0000000..1f40548 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql @@ -0,0 +1,8 @@ +BEGIN; + +ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index bb441f6..cfb2023 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -31,6 +31,7 @@ using System.Data; using System.IO; using System.Reflection; using System.Threading; +using System.Drawing; using OpenMetaverse; using log4net; using Mono.Data.SqliteClient; @@ -666,6 +667,10 @@ namespace OpenSim.Data.SQLite createCol(prims, "SceneGroupID", typeof (String)); // various text fields createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); createCol(prims, "Description", typeof (String)); createCol(prims, "SitName", typeof (String)); createCol(prims, "TouchName", typeof (String)); @@ -890,6 +895,10 @@ namespace OpenSim.Data.SQLite prim.Name = (String) row["Name"]; // various text fields prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); prim.Description = (String) row["Description"]; prim.SitName = (String) row["SitName"]; prim.TouchName = (String) row["TouchName"]; -- cgit v1.1