From d47a18fd09cfa7abc5fbd646a7a8edbec12c870c Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 11 Jun 2013 08:56:20 -0500 Subject: * Adds KeyFrameMotion storage support to SQLite, just a note, seems that there's still something wrong with keyframed motion starting when the sim starts up, you have to 'select' and 'deselect' the prim again to get it to appear to move. Not sure what this is but maybe melanie_t can comment on this. * Has a prim table migration.. that might take a while, hold on to your hats. * Fixes a null-ref when shutting down while keyframed motion is active. --- .../Data/SQLite/Resources/RegionStore.migrations | 8 ++++++++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 24 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index c6f4b48..bff039d 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -592,3 +592,11 @@ ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; COMMIT; + +:VERSION 29 #---------------- Keyframes + +BEGIN; + +ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index d4734a6..70b76c9 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -732,6 +732,8 @@ namespace OpenSim.Data.SQLite } SceneObjectGroup group = new SceneObjectGroup(prim); + if (prim.KeyframeMotion != null) + prim.KeyframeMotion.UpdateSceneObject(group); createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); @@ -1241,6 +1243,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "Friction", typeof(Double)); createCol(prims, "Restitution", typeof(Double)); + createCol(prims, "KeyframeMotion", typeof(Byte[])); // Add in contraints prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; @@ -1736,6 +1739,20 @@ namespace OpenSim.Data.SQLite prim.Friction = Convert.ToSingle(row["Friction"]); prim.Restitution = Convert.ToSingle(row["Restitution"]); + + if (!(row["KeyframeMotion"] is DBNull)) + { + Byte[] data = (byte[])row["KeyframeMotion"]; + if (data.Length > 0) + prim.KeyframeMotion = KeyframeMotion.FromData(null, data); + else + prim.KeyframeMotion = null; + } + else + { + prim.KeyframeMotion = null; + } + return prim; } @@ -2168,6 +2185,13 @@ namespace OpenSim.Data.SQLite row["GravityModifier"] = (double)prim.GravityModifier; row["Friction"] = (double)prim.Friction; row["Restitution"] = (double)prim.Restitution; + + if (prim.KeyframeMotion != null) + row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); + else + row["KeyframeMotion"] = new Byte[0]; + + } /// -- cgit v1.1