diff options
author | Justin Clark-Casey (justincc) | 2010-07-01 22:52:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-01 22:52:31 +0100 |
commit | 53ddcf6d25b5ff85847f3762b15f22d1dd2f49a5 (patch) | |
tree | a79ba95917c012a46aecb62a7efc14e32064262a | |
parent | handle ObjectMediaNavigateMessage (diff) | |
download | opensim-SC-53ddcf6d25b5ff85847f3762b15f22d1dd2f49a5.zip opensim-SC-53ddcf6d25b5ff85847f3762b15f22d1dd2f49a5.tar.gz opensim-SC-53ddcf6d25b5ff85847f3762b15f22d1dd2f49a5.tar.bz2 opensim-SC-53ddcf6d25b5ff85847f3762b15f22d1dd2f49a5.tar.xz |
Implement media texture persistence over server restarts for sqlite
This is currently persisting media as an OSDArray serialized to LLSD XML.
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 | ||||
-rw-r--r-- | prebuild.xml | 1 |
3 files changed, 54 insertions, 5 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 81d0ac4..fc9667b 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -34,6 +34,7 @@ using System.Reflection; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Data.Sqlite; | 35 | using Mono.Data.Sqlite; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -974,6 +975,8 @@ namespace OpenSim.Data.SQLite | |||
974 | createCol(prims, "CollisionSoundVolume", typeof(Double)); | 975 | createCol(prims, "CollisionSoundVolume", typeof(Double)); |
975 | 976 | ||
976 | createCol(prims, "VolumeDetect", typeof(Int16)); | 977 | createCol(prims, "VolumeDetect", typeof(Int16)); |
978 | |||
979 | createCol(prims, "MediaURL", typeof(String)); | ||
977 | 980 | ||
978 | // Add in contraints | 981 | // Add in contraints |
979 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; | 982 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
@@ -1021,6 +1024,7 @@ namespace OpenSim.Data.SQLite | |||
1021 | // way to specify this as a blob atm | 1024 | // way to specify this as a blob atm |
1022 | createCol(shapes, "Texture", typeof (Byte[])); | 1025 | createCol(shapes, "Texture", typeof (Byte[])); |
1023 | createCol(shapes, "ExtraParams", typeof (Byte[])); | 1026 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
1027 | createCol(shapes, "Media", typeof(String)); | ||
1024 | 1028 | ||
1025 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; | 1029 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
1026 | 1030 | ||
@@ -1339,6 +1343,12 @@ namespace OpenSim.Data.SQLite | |||
1339 | 1343 | ||
1340 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) | 1344 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) |
1341 | prim.VolumeDetectActive = true; | 1345 | prim.VolumeDetectActive = true; |
1346 | |||
1347 | if (!(row["MediaURL"] is System.DBNull)) | ||
1348 | { | ||
1349 | m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); | ||
1350 | prim.MediaUrl = (string)row["MediaURL"]; | ||
1351 | } | ||
1342 | 1352 | ||
1343 | return prim; | 1353 | return prim; |
1344 | } | 1354 | } |
@@ -1614,7 +1624,6 @@ namespace OpenSim.Data.SQLite | |||
1614 | row["PayButton3"] = prim.PayPrice[3]; | 1624 | row["PayButton3"] = prim.PayPrice[3]; |
1615 | row["PayButton4"] = prim.PayPrice[4]; | 1625 | row["PayButton4"] = prim.PayPrice[4]; |
1616 | 1626 | ||
1617 | |||
1618 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); | 1627 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); |
1619 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); | 1628 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); |
1620 | 1629 | ||
@@ -1674,7 +1683,8 @@ namespace OpenSim.Data.SQLite | |||
1674 | row["VolumeDetect"] = 1; | 1683 | row["VolumeDetect"] = 1; |
1675 | else | 1684 | else |
1676 | row["VolumeDetect"] = 0; | 1685 | row["VolumeDetect"] = 0; |
1677 | 1686 | ||
1687 | row["MediaURL"] = prim.MediaUrl; | ||
1678 | } | 1688 | } |
1679 | 1689 | ||
1680 | /// <summary> | 1690 | /// <summary> |
@@ -1849,6 +1859,19 @@ namespace OpenSim.Data.SQLite | |||
1849 | s.TextureEntry = textureEntry; | 1859 | s.TextureEntry = textureEntry; |
1850 | 1860 | ||
1851 | s.ExtraParams = (byte[]) row["ExtraParams"]; | 1861 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
1862 | |||
1863 | if (!(row["Media"] is System.DBNull)) | ||
1864 | { | ||
1865 | string rawMeArray = (string)row["Media"]; | ||
1866 | OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(rawMeArray); | ||
1867 | |||
1868 | List<MediaEntry> mediaEntries = new List<MediaEntry>(); | ||
1869 | foreach (OSD osdMe in osdMeArray) | ||
1870 | mediaEntries.Add(MediaEntry.FromOSD(osdMe)); | ||
1871 | |||
1872 | s.Media = mediaEntries; | ||
1873 | } | ||
1874 | |||
1852 | return s; | 1875 | return s; |
1853 | } | 1876 | } |
1854 | 1877 | ||
@@ -1892,17 +1915,22 @@ namespace OpenSim.Data.SQLite | |||
1892 | 1915 | ||
1893 | row["Texture"] = s.TextureEntry; | 1916 | row["Texture"] = s.TextureEntry; |
1894 | row["ExtraParams"] = s.ExtraParams; | 1917 | row["ExtraParams"] = s.ExtraParams; |
1918 | |||
1919 | OSDArray meArray = new OSDArray(); | ||
1920 | foreach (MediaEntry me in s.Media) | ||
1921 | meArray.Add(me.GetOSD()); | ||
1922 | |||
1923 | row["Media"] = OSDParser.SerializeLLSDXmlString(meArray); | ||
1895 | } | 1924 | } |
1896 | 1925 | ||
1897 | /// <summary> | 1926 | /// <summary> |
1898 | /// | 1927 | /// Persistently store a prim. |
1899 | /// </summary> | 1928 | /// </summary> |
1900 | /// <param name="prim"></param> | 1929 | /// <param name="prim"></param> |
1901 | /// <param name="sceneGroupID"></param> | 1930 | /// <param name="sceneGroupID"></param> |
1902 | /// <param name="regionUUID"></param> | 1931 | /// <param name="regionUUID"></param> |
1903 | private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | 1932 | private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) |
1904 | { | 1933 | { |
1905 | |||
1906 | DataTable prims = ds.Tables["prims"]; | 1934 | DataTable prims = ds.Tables["prims"]; |
1907 | DataTable shapes = ds.Tables["primshapes"]; | 1935 | DataTable shapes = ds.Tables["primshapes"]; |
1908 | 1936 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f83c4cf..1e5133b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -317,6 +317,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
317 | protected Vector3 m_lastAcceleration; | 317 | protected Vector3 m_lastAcceleration; |
318 | protected Vector3 m_lastAngularVelocity; | 318 | protected Vector3 m_lastAngularVelocity; |
319 | protected int m_lastTerseSent; | 319 | protected int m_lastTerseSent; |
320 | |||
321 | /// <summary> | ||
322 | /// Stores media texture data | ||
323 | /// </summary> | ||
324 | protected string m_mediaUrl; | ||
320 | 325 | ||
321 | // TODO: Those have to be changed into persistent properties at some later point, | 326 | // TODO: Those have to be changed into persistent properties at some later point, |
322 | // or sit-camera on vehicles will break on sim-crossing. | 327 | // or sit-camera on vehicles will break on sim-crossing. |
@@ -962,6 +967,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
962 | TriggerScriptChangedEvent(Changed.SCALE); | 967 | TriggerScriptChangedEvent(Changed.SCALE); |
963 | } | 968 | } |
964 | } | 969 | } |
970 | |||
965 | public byte UpdateFlag | 971 | public byte UpdateFlag |
966 | { | 972 | { |
967 | get { return m_updateFlag; } | 973 | get { return m_updateFlag; } |
@@ -971,7 +977,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | /// <summary> | 977 | /// <summary> |
972 | /// Used for media on a prim | 978 | /// Used for media on a prim |
973 | /// </summary> | 979 | /// </summary> |
974 | public string MediaUrl { get; set; } | 980 | public string MediaUrl |
981 | { | ||
982 | get | ||
983 | { | ||
984 | return m_mediaUrl; | ||
985 | } | ||
986 | |||
987 | set | ||
988 | { | ||
989 | m_mediaUrl = value; | ||
990 | |||
991 | if (ParentGroup != null) | ||
992 | ParentGroup.HasGroupChanged = true; | ||
993 | } | ||
994 | } | ||
975 | 995 | ||
976 | [XmlIgnore] | 996 | [XmlIgnore] |
977 | public bool CreateSelected | 997 | public bool CreateSelected |
diff --git a/prebuild.xml b/prebuild.xml index 1eb8fee..1eabc4b 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -2238,6 +2238,7 @@ | |||
2238 | <Reference name="OpenSim.Region.Framework"/> | 2238 | <Reference name="OpenSim.Region.Framework"/> |
2239 | <Reference name="OpenMetaverseTypes.dll"/> | 2239 | <Reference name="OpenMetaverseTypes.dll"/> |
2240 | <Reference name="OpenMetaverse.dll"/> | 2240 | <Reference name="OpenMetaverse.dll"/> |
2241 | <Reference name="OpenMetaverse.StructuredData.dll"/> | ||
2241 | <Reference name="Mono.Data.Sqlite"/> | 2242 | <Reference name="Mono.Data.Sqlite"/> |
2242 | <Reference name="Mono.Addins.dll" /> | 2243 | <Reference name="Mono.Addins.dll" /> |
2243 | <Reference name="log4net.dll"/> | 2244 | <Reference name="log4net.dll"/> |