From 9d8a67fe1348419c41374d1be77737bfa048106c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Aug 2010 16:26:27 +0100 Subject: 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 --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 8 +++-- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 8 +++-- OpenSim/Data/SQLite/SQLiteRegionData.cs | 8 +++-- OpenSim/Framework/PrimitiveBaseShape.cs | 6 ---- .../CoreModules/World/Media/Moap/MoapModule.cs | 34 ---------------------- 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 { } - if (!(shapeRow["Media"] is System.DBNull)) - baseShape.MediaRaw = (string)shapeRow["Media"]; + if (!(shapeRow["Media"] is System.DBNull)) + baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); return baseShape; } @@ -1560,7 +1560,9 @@ VALUES parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); parameters.Add(_Database.CreateParameter("State", s.State)); - parameters.Add(_Database.CreateParameter("Media", s.MediaRaw)); + + if (s.Media != null) + parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); return parameters.ToArray(); } 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 s.State = (byte)(int)row["State"]; - if (!(row["Media"] is System.DBNull)) - s.MediaRaw = (string)row["Media"]; + if (!(row["Media"] is System.DBNull)) + s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); return s; } @@ -1746,7 +1746,9 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Texture", s.TextureEntry); cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); cmd.Parameters.AddWithValue("State", s.State); - cmd.Parameters.AddWithValue("Media", s.MediaRaw); + + if (s.Media != null) + cmd.Parameters.AddWithValue("Media", s.Media.ToXml()); } public void StorePrimInventory(UUID primID, ICollection 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 if (!(row["MediaURL"] is System.DBNull)) { - m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); + //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); prim.MediaUrl = (string)row["MediaURL"]; } @@ -1861,7 +1861,7 @@ namespace OpenSim.Data.SQLite s.ExtraParams = (byte[]) row["ExtraParams"]; if (!(row["Media"] is System.DBNull)) - s.MediaRaw = (string)row["Media"]; + s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); return s; } @@ -1906,7 +1906,9 @@ namespace OpenSim.Data.SQLite row["Texture"] = s.TextureEntry; row["ExtraParams"] = s.ExtraParams; - row["Media"] = s.MediaRaw; + + if (s.Media != null) + row["Media"] = s.Media.ToXml(); } /// 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 } } } - - /// - /// Raw media data suitable for serialization operations. This should only ever be used by an IMoapModule. - /// - [XmlIgnore] - public string MediaRaw { get; set; } /// /// 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 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; - m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; - m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave; m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy; } @@ -132,8 +130,6 @@ namespace OpenSim.Region.CoreModules.Media.Moap m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; - m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; - m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave; m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; } @@ -184,36 +180,6 @@ namespace OpenSim.Region.CoreModules.Media.Moap } } - public void OnSceneObjectLoaded(SceneObjectGroup so) - { -// m_log.DebugFormat("[MOAP]: OnSceneObjectLoaded fired for {0} {1}", so.Name, so.UUID); - - so.ForEachPart(OnSceneObjectPartLoaded); - } - - public void OnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) - { -// m_log.DebugFormat("[MOAP]: OnSceneObjectPreSave fired for {0} {1}", persistingSo.Name, persistingSo.UUID); - - persistingSo.ForEachPart(OnSceneObjectPartPreSave); - } - - protected void OnSceneObjectPartLoaded(SceneObjectPart part) - { - if (null == part.Shape.MediaRaw) - return; - - part.Shape.Media = PrimitiveBaseShape.MediaList.FromXml(part.Shape.MediaRaw); - } - - protected void OnSceneObjectPartPreSave(SceneObjectPart part) - { - if (null == part.Shape.Media) - return; - - part.Shape.MediaRaw = part.Shape.Media.ToXml(); - } - protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) { if (original.Shape.Media != null) -- cgit v1.1