diff options
5 files changed, 43 insertions, 15 deletions
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'; | |||
592 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | 592 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; |
593 | 593 | ||
594 | COMMIT; | 594 | COMMIT; |
595 | |||
596 | :VERSION 29 #---------------- Keyframes | ||
597 | |||
598 | BEGIN; | ||
599 | |||
600 | ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; | ||
601 | |||
602 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 99a6598..c8e48fd 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -732,6 +732,8 @@ namespace OpenSim.Data.SQLite | |||
732 | } | 732 | } |
733 | 733 | ||
734 | SceneObjectGroup group = new SceneObjectGroup(prim); | 734 | SceneObjectGroup group = new SceneObjectGroup(prim); |
735 | if (prim.KeyframeMotion != null) | ||
736 | prim.KeyframeMotion.UpdateSceneObject(group); | ||
735 | createdObjects.Add(group.UUID, group); | 737 | createdObjects.Add(group.UUID, group); |
736 | retvals.Add(group); | 738 | retvals.Add(group); |
737 | LoadItems(prim); | 739 | LoadItems(prim); |
@@ -1241,6 +1243,7 @@ namespace OpenSim.Data.SQLite | |||
1241 | createCol(prims, "Friction", typeof(Double)); | 1243 | createCol(prims, "Friction", typeof(Double)); |
1242 | createCol(prims, "Restitution", typeof(Double)); | 1244 | createCol(prims, "Restitution", typeof(Double)); |
1243 | 1245 | ||
1246 | createCol(prims, "KeyframeMotion", typeof(Byte[])); | ||
1244 | // Add in contraints | 1247 | // Add in contraints |
1245 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 1248 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; |
1246 | 1249 | ||
@@ -1736,6 +1739,20 @@ namespace OpenSim.Data.SQLite | |||
1736 | prim.Friction = Convert.ToSingle(row["Friction"]); | 1739 | prim.Friction = Convert.ToSingle(row["Friction"]); |
1737 | prim.Restitution = Convert.ToSingle(row["Restitution"]); | 1740 | prim.Restitution = Convert.ToSingle(row["Restitution"]); |
1738 | 1741 | ||
1742 | |||
1743 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1744 | { | ||
1745 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1746 | if (data.Length > 0) | ||
1747 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1748 | else | ||
1749 | prim.KeyframeMotion = null; | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | prim.KeyframeMotion = null; | ||
1754 | } | ||
1755 | |||
1739 | return prim; | 1756 | return prim; |
1740 | } | 1757 | } |
1741 | 1758 | ||
@@ -2168,6 +2185,13 @@ namespace OpenSim.Data.SQLite | |||
2168 | row["GravityModifier"] = (double)prim.GravityModifier; | 2185 | row["GravityModifier"] = (double)prim.GravityModifier; |
2169 | row["Friction"] = (double)prim.Friction; | 2186 | row["Friction"] = (double)prim.Friction; |
2170 | row["Restitution"] = (double)prim.Restitution; | 2187 | row["Restitution"] = (double)prim.Restitution; |
2188 | |||
2189 | if (prim.KeyframeMotion != null) | ||
2190 | row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); | ||
2191 | else | ||
2192 | row["KeyframeMotion"] = new Byte[0]; | ||
2193 | |||
2194 | |||
2171 | } | 2195 | } |
2172 | 2196 | ||
2173 | /// <summary> | 2197 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8c6450d..f13f7ab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -822,7 +822,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
822 | } | 822 | } |
823 | 823 | ||
824 | // Tell the physics engines that this prim changed. | 824 | // Tell the physics engines that this prim changed. |
825 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 825 | if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) |
826 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | ||
826 | } | 827 | } |
827 | catch (Exception e) | 828 | catch (Exception e) |
828 | { | 829 | { |
@@ -940,7 +941,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
940 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); | 941 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); |
941 | } | 942 | } |
942 | 943 | ||
943 | if (ParentGroup != null) | 944 | if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) |
944 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 945 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
945 | //} | 946 | //} |
946 | } | 947 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c315d03..9744526 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5136,6 +5136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5136 | else | 5136 | else |
5137 | { | 5137 | { |
5138 | double invS = 1.0 / s; | 5138 | double invS = 1.0 / s; |
5139 | if (rot.s < 0) invS = -invS; | ||
5139 | return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS); | 5140 | return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS); |
5140 | } | 5141 | } |
5141 | } | 5142 | } |
@@ -5146,19 +5147,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5146 | { | 5147 | { |
5147 | m_host.AddScriptLPS(1); | 5148 | m_host.AddScriptLPS(1); |
5148 | 5149 | ||
5149 | if (rot.s > 1) // normalization needed | 5150 | if (Math.Abs(rot.s) > 1) // normalization needed |
5150 | { | 5151 | rot.Normalize(); |
5151 | double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y + | ||
5152 | rot.z * rot.z + rot.s * rot.s); | ||
5153 | |||
5154 | rot.x /= length; | ||
5155 | rot.y /= length; | ||
5156 | rot.z /= length; | ||
5157 | rot.s /= length; | ||
5158 | } | ||
5159 | 5152 | ||
5160 | double angle = 2 * Math.Acos(rot.s); | 5153 | double angle = 2 * Math.Acos(rot.s); |
5161 | if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; | 5154 | if (angle > Math.PI) |
5155 | angle = 2 * Math.PI - angle; | ||
5156 | |||
5162 | return angle; | 5157 | return angle; |
5163 | } | 5158 | } |
5164 | 5159 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index c685afb..4ba0e64 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -377,10 +377,10 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
377 | double length = Math.Sqrt(x * x + y * y + z * z + s * s); | 377 | double length = Math.Sqrt(x * x + y * y + z * z + s * s); |
378 | if (length < float.Epsilon) | 378 | if (length < float.Epsilon) |
379 | { | 379 | { |
380 | x = 1; | 380 | x = 0; |
381 | y = 0; | 381 | y = 0; |
382 | z = 0; | 382 | z = 0; |
383 | s = 0; | 383 | s = 1; |
384 | } | 384 | } |
385 | else | 385 | else |
386 | { | 386 | { |