aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-01 22:52:31 +0100
committerJustin Clark-Casey (justincc)2010-07-26 23:34:19 +0100
commit9682e0c73310dae496912d7b8bc54add0fd0c3e7 (patch)
tree1491ee1b1cd4bc278b64753fde46acfd93f5cb02 /OpenSim
parenthandle ObjectMediaNavigateMessage (diff)
downloadopensim-SC_OLD-9682e0c73310dae496912d7b8bc54add0fd0c3e7.zip
opensim-SC_OLD-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.gz
opensim-SC_OLD-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.bz2
opensim-SC_OLD-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.xz
Implement media texture persistence over server restarts for sqlite
This is currently persisting media as an OSDArray serialized to LLSD XML.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs22
2 files changed, 53 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;
34using log4net; 34using log4net;
35using Mono.Data.Sqlite; 35using Mono.Data.Sqlite;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using 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 c25c973..a8c20dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -320,6 +320,11 @@ namespace OpenSim.Region.Framework.Scenes
320 protected Vector3 m_lastAcceleration; 320 protected Vector3 m_lastAcceleration;
321 protected Vector3 m_lastAngularVelocity; 321 protected Vector3 m_lastAngularVelocity;
322 protected int m_lastTerseSent; 322 protected int m_lastTerseSent;
323
324 /// <summary>
325 /// Stores media texture data
326 /// </summary>
327 protected string m_mediaUrl;
323 328
324 // TODO: Those have to be changed into persistent properties at some later point, 329 // TODO: Those have to be changed into persistent properties at some later point,
325 // or sit-camera on vehicles will break on sim-crossing. 330 // or sit-camera on vehicles will break on sim-crossing.
@@ -965,6 +970,7 @@ namespace OpenSim.Region.Framework.Scenes
965 TriggerScriptChangedEvent(Changed.SCALE); 970 TriggerScriptChangedEvent(Changed.SCALE);
966 } 971 }
967 } 972 }
973
968 public byte UpdateFlag 974 public byte UpdateFlag
969 { 975 {
970 get { return m_updateFlag; } 976 get { return m_updateFlag; }
@@ -974,7 +980,21 @@ namespace OpenSim.Region.Framework.Scenes
974 /// <summary> 980 /// <summary>
975 /// Used for media on a prim 981 /// Used for media on a prim
976 /// </summary> 982 /// </summary>
977 public string MediaUrl { get; set; } 983 public string MediaUrl
984 {
985 get
986 {
987 return m_mediaUrl;
988 }
989
990 set
991 {
992 m_mediaUrl = value;
993
994 if (ParentGroup != null)
995 ParentGroup.HasGroupChanged = true;
996 }
997 }
978 998
979 [XmlIgnore] 999 [XmlIgnore]
980 public bool CreateSelected 1000 public bool CreateSelected