aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-03 16:26:27 +0100
committerJustin Clark-Casey (justincc)2010-08-03 16:26:27 +0100
commit9d8a67fe1348419c41374d1be77737bfa048106c (patch)
tree5d29a07998c697a901cfdadf20e2e2cc579300cf
parentremove duplicated serialization code (diff)
downloadopensim-SC_OLD-9d8a67fe1348419c41374d1be77737bfa048106c.zip
opensim-SC_OLD-9d8a67fe1348419c41374d1be77737bfa048106c.tar.gz
opensim-SC_OLD-9d8a67fe1348419c41374d1be77737bfa048106c.tar.bz2
opensim-SC_OLD-9d8a67fe1348419c41374d1be77737bfa048106c.tar.xz
get rid of PrimitiveBaseShape.MediaRaw staging post
using an OSD serialization rather than auto forces serialization code to be placed in OpenSim.Framework this makes the media texture raw data staging post in PrimitiveBaseShape redundant, now we just directly call the code in PrimitiveBaseShape.MediaList itself
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs8
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs34
5 files changed, 15 insertions, 49 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
index e61b4d9..9d819b3 100644
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
@@ -1180,8 +1180,8 @@ VALUES
1180 { 1180 {
1181 } 1181 }
1182 1182
1183 if (!(shapeRow["Media"] is System.DBNull)) 1183 if (!(shapeRow["Media"] is System.DBNull))
1184 baseShape.MediaRaw = (string)shapeRow["Media"]; 1184 baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
1185 1185
1186 return baseShape; 1186 return baseShape;
1187 } 1187 }
@@ -1560,7 +1560,9 @@ VALUES
1560 parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); 1560 parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
1561 parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); 1561 parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
1562 parameters.Add(_Database.CreateParameter("State", s.State)); 1562 parameters.Add(_Database.CreateParameter("State", s.State));
1563 parameters.Add(_Database.CreateParameter("Media", s.MediaRaw)); 1563
1564 if (s.Media != null)
1565 parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml()));
1564 1566
1565 return parameters.ToArray(); 1567 return parameters.ToArray();
1566 } 1568 }
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index f17e8ae..50fcd96 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -1701,8 +1701,8 @@ namespace OpenSim.Data.MySQL
1701 1701
1702 s.State = (byte)(int)row["State"]; 1702 s.State = (byte)(int)row["State"];
1703 1703
1704 if (!(row["Media"] is System.DBNull)) 1704 if (!(row["Media"] is System.DBNull))
1705 s.MediaRaw = (string)row["Media"]; 1705 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
1706 1706
1707 return s; 1707 return s;
1708 } 1708 }
@@ -1746,7 +1746,9 @@ namespace OpenSim.Data.MySQL
1746 cmd.Parameters.AddWithValue("Texture", s.TextureEntry); 1746 cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
1747 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); 1747 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
1748 cmd.Parameters.AddWithValue("State", s.State); 1748 cmd.Parameters.AddWithValue("State", s.State);
1749 cmd.Parameters.AddWithValue("Media", s.MediaRaw); 1749
1750 if (s.Media != null)
1751 cmd.Parameters.AddWithValue("Media", s.Media.ToXml());
1750 } 1752 }
1751 1753
1752 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1754 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index f63d35e..4208050 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1346,7 +1346,7 @@ namespace OpenSim.Data.SQLite
1346 1346
1347 if (!(row["MediaURL"] is System.DBNull)) 1347 if (!(row["MediaURL"] is System.DBNull))
1348 { 1348 {
1349 m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1349 //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
1350 prim.MediaUrl = (string)row["MediaURL"]; 1350 prim.MediaUrl = (string)row["MediaURL"];
1351 } 1351 }
1352 1352
@@ -1861,7 +1861,7 @@ namespace OpenSim.Data.SQLite
1861 s.ExtraParams = (byte[]) row["ExtraParams"]; 1861 s.ExtraParams = (byte[]) row["ExtraParams"];
1862 1862
1863 if (!(row["Media"] is System.DBNull)) 1863 if (!(row["Media"] is System.DBNull))
1864 s.MediaRaw = (string)row["Media"]; 1864 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
1865 1865
1866 return s; 1866 return s;
1867 } 1867 }
@@ -1906,7 +1906,9 @@ namespace OpenSim.Data.SQLite
1906 1906
1907 row["Texture"] = s.TextureEntry; 1907 row["Texture"] = s.TextureEntry;
1908 row["ExtraParams"] = s.ExtraParams; 1908 row["ExtraParams"] = s.ExtraParams;
1909 row["Media"] = s.MediaRaw; 1909
1910 if (s.Media != null)
1911 row["Media"] = s.Media.ToXml();
1910 } 1912 }
1911 1913
1912 /// <summary> 1914 /// <summary>
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 685599a..9b52fe6 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -175,12 +175,6 @@ namespace OpenSim.Framework
175 } 175 }
176 } 176 }
177 } 177 }
178
179 /// <summary>
180 /// Raw media data suitable for serialization operations. This should only ever be used by an IMoapModule.
181 /// </summary>
182 [XmlIgnore]
183 public string MediaRaw { get; set; }
184 178
185 /// <summary> 179 /// <summary>
186 /// Entries to store media textures on each face 180 /// Entries to store media textures on each face
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 52acf81..d7ce184 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -120,8 +120,6 @@ namespace OpenSim.Region.CoreModules.Media.Moap
120 120
121 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; 121 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
122 m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; 122 m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
123 m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded;
124 m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave;
125 m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy; 123 m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy;
126 } 124 }
127 125
@@ -132,8 +130,6 @@ namespace OpenSim.Region.CoreModules.Media.Moap
132 130
133 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; 131 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
134 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; 132 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
135 m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded;
136 m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave;
137 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; 133 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
138 } 134 }
139 135
@@ -184,36 +180,6 @@ namespace OpenSim.Region.CoreModules.Media.Moap
184 } 180 }
185 } 181 }
186 182
187 public void OnSceneObjectLoaded(SceneObjectGroup so)
188 {
189// m_log.DebugFormat("[MOAP]: OnSceneObjectLoaded fired for {0} {1}", so.Name, so.UUID);
190
191 so.ForEachPart(OnSceneObjectPartLoaded);
192 }
193
194 public void OnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
195 {
196// m_log.DebugFormat("[MOAP]: OnSceneObjectPreSave fired for {0} {1}", persistingSo.Name, persistingSo.UUID);
197
198 persistingSo.ForEachPart(OnSceneObjectPartPreSave);
199 }
200
201 protected void OnSceneObjectPartLoaded(SceneObjectPart part)
202 {
203 if (null == part.Shape.MediaRaw)
204 return;
205
206 part.Shape.Media = PrimitiveBaseShape.MediaList.FromXml(part.Shape.MediaRaw);
207 }
208
209 protected void OnSceneObjectPartPreSave(SceneObjectPart part)
210 {
211 if (null == part.Shape.Media)
212 return;
213
214 part.Shape.MediaRaw = part.Shape.Media.ToXml();
215 }
216
217 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) 183 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
218 { 184 {
219 if (original.Shape.Media != null) 185 if (original.Shape.Media != null)