From 4b00203fa5d1ae645cf7bd67d061ee751d5c447b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Jun 2013 00:15:55 +0100 Subject: Tidy up SOG.UpdateRootPosition() to eliminate unnecessary copying of Vector3 structs --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f1036ae..75d0667 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3028,8 +3028,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Update just the root prim position in a linkset /// - /// - public void UpdateRootPosition(Vector3 pos) + /// + public void UpdateRootPosition(Vector3 newPos) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); @@ -3038,16 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes // for (int i = 0; i < parts.Length; i++) // parts[i].StoreUndoState(); - Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); - Vector3 oldPos = - new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, - AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, - AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); + Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition; Vector3 diff = oldPos - newPos; - Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); Quaternion partRotation = m_rootPart.RotationOffset; - axDiff *= Quaternion.Inverse(partRotation); - diff = axDiff; + diff *= Quaternion.Inverse(partRotation); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) -- cgit v1.1 From ce9b1320d273890610a2ccd4f1ada39498135049 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Jun 2013 00:41:46 +0100 Subject: Improve situation where editing just the root prim of an attachment causes other prims to be set to very far off positions on reattach. Functionally the same as the patch by tglion in http://opensimulator.org/mantis/view.php?id=5334 However, not yet perfect - after editing just root prim on reattach the position is still wrong, though other prims are not set to far off positions. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 75d0667..4b4e4ba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3038,7 +3038,16 @@ namespace OpenSim.Region.Framework.Scenes // for (int i = 0; i < parts.Length; i++) // parts[i].StoreUndoState(); - Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition; + Vector3 oldPos; + + // FIXME: This improves the situation where editing just the root prim of an attached object would send + // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim + // still ends up in the wrong position on reattach. + if (IsAttachment) + oldPos = RootPart.OffsetPosition; + else + oldPos = AbsolutePosition + RootPart.OffsetPosition; + Vector3 diff = oldPos - newPos; Quaternion partRotation = m_rootPart.RotationOffset; diff *= Quaternion.Inverse(partRotation); -- cgit v1.1 From f78d2ef166a523397c770858176eff646be4021d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Jun 2013 00:46:15 +0100 Subject: Update temporary "Unknown UserUMMTGUN2" name to "Unknown UserUMMTGUN3" to see if Diva's recent HG updates (post 6c7e33f) fix this issue. This string is returned if a UserManagementModule.TryGetUserNames() cannot find a server-side name binding or a user account for a given UUID. This is only called when the viewer requests a binding via the UDP UUIDNameRequest message --- .../Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 864e181..194b591 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -320,7 +320,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement else { names[0] = "Unknown"; - names[1] = "UserUMMTGUN2"; + names[1] = "UserUMMTGUN3"; return false; } -- cgit v1.1 From f7d09b898ad6df32b3f07cb64657623980178c2f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 27 Jun 2013 23:14:28 +0100 Subject: Make the concept of namespaces explicit in dynamic attributes This is in order to reduce the likelihood of naming clashes, make it easier to filter in/out attributes, ensure uniformity, etc. All dynattrs in the opensim distro itself or likely future ones should be in the "OpenSim" namespace. This does alter the underlying dynattrs data structure. All data in previous structures may not be available, though old structures should not cause errors. This is done without notice since this feature has been explicitly labelled as experimental, subject to change and has not been in a release. However, existing materials data is being preserved by moving it to the "Materials" store in the "OpenSim" namespace. --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 2 +- OpenSim/Data/MySQL/MySQLSimulationData.cs | 2 +- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2 +- OpenSim/Framework/DAMap.cs | 300 ++++++++++++--------- OpenSim/Framework/DOMap.cs | 8 +- .../Framework/DynamicAttributes/DAExampleModule.cs | 17 +- .../Framework/DynamicAttributes/DOExampleModule.cs | 8 +- .../World/Serialiser/Tests/SerialiserTests.cs | 44 ++- .../Scenes/Serialization/SceneObjectSerializer.cs | 2 +- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 18 +- .../Materials/MaterialsDemoModule.cs | 26 +- 11 files changed, 257 insertions(+), 172 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 476f57a..5135050 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -2100,7 +2100,7 @@ VALUES parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); - if (prim.DynAttrs.Count > 0) + if (prim.DynAttrs.CountNamespaces > 0) parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); else parameters.Add(_Database.CreateParameter("DynAttrs", null)); diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index de52623..cf367ef 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1679,7 +1679,7 @@ namespace OpenSim.Data.MySQL else cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); - if (prim.DynAttrs.Count > 0) + if (prim.DynAttrs.CountNamespaces > 0) cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); else cmd.Parameters.AddWithValue("DynAttrs", null); diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index c35bba2..eba6612 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -2176,7 +2176,7 @@ namespace OpenSim.Data.SQLite row["MediaURL"] = prim.MediaUrl; - if (prim.DynAttrs.Count > 0) + if (prim.DynAttrs.CountNamespaces > 0) row["DynAttrs"] = prim.DynAttrs.ToXml(); else row["DynAttrs"] = null; diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index df4a6bc..a57393b 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -29,10 +29,12 @@ using System; using System.Collections; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Text; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; +using log4net; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -48,13 +50,20 @@ namespace OpenSim.Framework /// within their data store. However, avoid storing large amounts of data because that /// would slow down database access. /// - public class DAMap : IDictionary, IXmlSerializable + public class DAMap : IXmlSerializable { - private static readonly int MIN_STORE_NAME_LENGTH = 4; +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected OSDMap m_map; - - public DAMap() { m_map = new OSDMap(); } + private static readonly int MIN_NAMESPACE_LENGTH = 4; + + private OSDMap m_map = new OSDMap(); + + // WARNING: this is temporary for experimentation only, it will be removed!!!! + public OSDMap TopLevelMap + { + get { return m_map; } + set { m_map = value; } + } public XmlSchema GetSchema() { return null; } @@ -64,39 +73,34 @@ namespace OpenSim.Framework map.ReadXml(rawXml); return map; } - + + public void ReadXml(XmlReader reader) + { + ReadXml(reader.ReadInnerXml()); + } + public void ReadXml(string rawXml) { // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); lock (this) + { m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); + SanitiseMap(this); + } } - - // WARNING: this is temporary for experimentation only, it will be removed!!!! - public OSDMap TopLevelMap + + public void WriteXml(XmlWriter writer) { - get { return m_map; } - set { m_map = value; } + writer.WriteRaw(ToXml()); } - - public void ReadXml(XmlReader reader) - { - ReadXml(reader.ReadInnerXml()); - } - public string ToXml() { lock (this) return OSDParser.SerializeLLSDXmlString(m_map); } - public void WriteXml(XmlWriter writer) - { - writer.WriteRaw(ToXml()); - } - public void CopyFrom(DAMap other) { // Deep copy @@ -104,7 +108,7 @@ namespace OpenSim.Framework string data = null; lock (other) { - if (other.Count > 0) + if (other.CountNamespaces > 0) { data = OSDParser.SerializeLLSDXmlString(other.m_map); } @@ -120,59 +124,133 @@ namespace OpenSim.Framework } /// - /// Returns the number of data stores. + /// Sanitise the map to remove any namespaces or stores that are not OSDMap. /// - public int Count { get { lock (this) { return m_map.Count; } } } - - public bool IsReadOnly { get { return false; } } - + /// + /// + public static void SanitiseMap(DAMap daMap) + { + List keysToRemove = null; + + // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should + // handle reading data from old locations + bool osMaterialsMigrationRequired = false; + + OSDMap namespacesMap = daMap.m_map; + + foreach (string key in namespacesMap.Keys) + { +// Console.WriteLine("Processing ns {0}", key); + if (!(namespacesMap[key] is OSDMap)) + { + if (keysToRemove == null) + keysToRemove = new List(); + + keysToRemove.Add(key); + } + else if (key == "OS:Materials") + { + osMaterialsMigrationRequired = true; + } + } + + if (keysToRemove != null) + { + foreach (string key in keysToRemove) + { +// Console.WriteLine ("Removing bad ns {0}", key); + namespacesMap.Remove(key); + } + } + + // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should + // handle reading data from old locations + if (osMaterialsMigrationRequired) + daMap.SetStore("OpenSim", "Materials", (OSDMap)namespacesMap["OS:Materials"]); + + foreach (OSD nsOsd in namespacesMap.Values) + { + OSDMap nsOsdMap = (OSDMap)nsOsd; + keysToRemove = null; + + foreach (string key in nsOsdMap.Keys) + { + if (!(nsOsdMap[key] is OSDMap)) + { + if (keysToRemove == null) + keysToRemove = new List(); + + keysToRemove.Add(key); + } + } + + if (keysToRemove != null) + foreach (string key in keysToRemove) + nsOsdMap.Remove(key); + } + } + /// - /// Returns the names of the data stores. + /// Get the number of namespaces /// - public ICollection Keys { get { lock (this) { return m_map.Keys; } } } + public int CountNamespaces { get { lock (this) { return m_map.Count; } } } /// - /// Returns all the data stores. + /// Get the number of stores. /// - public ICollection Values + public int CountStores { - get + get { + int count = 0; + lock (this) { - List stores = new List(m_map.Count); - foreach (OSD llsd in m_map.Values) - stores.Add((OSDMap)llsd); - return stores; + foreach (OSD osdNamespace in m_map) + { + count += ((OSDMap)osdNamespace).Count; + } } + + return count; } } - - /// - /// Gets or sets one data store. - /// - /// Store name - /// - public OSDMap this[string key] - { - get - { - OSD llsd; - - lock (this) + + public OSDMap GetStore(string ns, string storeName) + { + OSD namespaceOsd; + + lock (this) + { + if (m_map.TryGetValue(ns, out namespaceOsd)) { - if (m_map.TryGetValue(key, out llsd)) - return (OSDMap)llsd; - else - return null; + OSD store; + + if (((OSDMap)namespaceOsd).TryGetValue(storeName, out store)) + return (OSDMap)store; } - } - - set + } + + return null; + } + + public void SetStore(string ns, string storeName, OSDMap store) + { + ValidateNamespace(ns); + OSDMap nsMap; + + lock (this) { - ValidateKey(key); - lock (this) - m_map[key] = value; + if (!m_map.ContainsKey(ns)) + { + nsMap = new OSDMap(); + m_map[ns] = nsMap; + } + + nsMap = (OSDMap)m_map[ns]; + +// m_log.DebugFormat("[DA MAP]: Setting store to {0}:{1}", ns, storeName); + nsMap[storeName] = store; } } @@ -180,54 +258,46 @@ namespace OpenSim.Framework /// Validate the key used for storing separate data stores. /// /// - public static void ValidateKey(string key) + public static void ValidateNamespace(string ns) { - if (key.Length < MIN_STORE_NAME_LENGTH) - throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH); + if (ns.Length < MIN_NAMESPACE_LENGTH) + throw new Exception("Minimum namespace length is " + MIN_NAMESPACE_LENGTH); } - public bool ContainsKey(string key) + public bool ContainsStore(string ns, string storeName) { - lock (this) - return m_map.ContainsKey(key); - } - - public void Add(string key, OSDMap store) - { - ValidateKey(key); - lock (this) - m_map.Add(key, store); - } + OSD namespaceOsd; - public void Add(KeyValuePair kvp) - { - ValidateKey(kvp.Key); lock (this) - m_map.Add(kvp.Key, kvp.Value); - } + { + if (m_map.TryGetValue(ns, out namespaceOsd)) + { + return ((OSDMap)namespaceOsd).ContainsKey(storeName); + } + } - public bool Remove(string key) - { - lock (this) - return m_map.Remove(key); - } + return false; + } - public bool TryGetValue(string key, out OSDMap store) + public bool TryGetStore(string ns, string storeName, out OSDMap store) { + OSD namespaceOsd; + lock (this) { - OSD llsd; - if (m_map.TryGetValue(key, out llsd)) - { - store = (OSDMap)llsd; - return true; - } - else + if (m_map.TryGetValue(ns, out namespaceOsd)) { - store = null; - return false; + OSD storeOsd; + + bool result = ((OSDMap)namespaceOsd).TryGetValue(storeName, out storeOsd); + store = (OSDMap)storeOsd; + + return result; } } + + store = null; + return false; } public void Clear() @@ -235,39 +305,25 @@ namespace OpenSim.Framework lock (this) m_map.Clear(); } - - public bool Contains(KeyValuePair kvp) - { - lock (this) - return m_map.ContainsKey(kvp.Key); - } - public void CopyTo(KeyValuePair[] array, int index) + public bool RemoveStore(string ns, string storeName) { - throw new NotImplementedException(); - } + OSD namespaceOsd; - public bool Remove(KeyValuePair kvp) - { - lock (this) - return m_map.Remove(kvp.Key); - } - - public System.Collections.IDictionaryEnumerator GetEnumerator() - { lock (this) - return m_map.GetEnumerator(); - } + { + if (m_map.TryGetValue(ns, out namespaceOsd)) + { + OSDMap namespaceOsdMap = (OSDMap)namespaceOsd; + namespaceOsdMap.Remove(storeName); - IEnumerator> IEnumerable>.GetEnumerator() - { - return null; - } + // Don't keep empty namespaces around + if (namespaceOsdMap.Count <= 0) + m_map.Remove(ns); + } + } - IEnumerator IEnumerable.GetEnumerator() - { - lock (this) - return m_map.GetEnumerator(); - } + return false; + } } } \ No newline at end of file diff --git a/OpenSim/Framework/DOMap.cs b/OpenSim/Framework/DOMap.cs index 755e129..f5b650b 100644 --- a/OpenSim/Framework/DOMap.cs +++ b/OpenSim/Framework/DOMap.cs @@ -42,22 +42,22 @@ namespace OpenSim.Framework /// This class stores and retrieves dynamic objects. /// /// - /// Experimental - DO NOT USE. + /// Experimental - DO NOT USE. Does not yet have namespace support. /// public class DOMap { private IDictionary m_map; - public void Add(string key, object dynObj) + public void Add(string ns, string objName, object dynObj) { - DAMap.ValidateKey(key); + DAMap.ValidateNamespace(ns); lock (this) { if (m_map == null) m_map = new Dictionary(); - m_map.Add(key, dynObj); + m_map.Add(objName, dynObj); } } diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs index 1f1568f..0c632b1 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs @@ -44,11 +44,12 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] public class DAExampleModule : INonSharedRegionModule { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly bool ENABLED = false; // enable for testing + private readonly bool ENABLED = false; // enable for testing - public const string DANamespace = "DAExample Module"; + public const string Namespace = "Example"; + public const string StoreName = "DA"; protected Scene m_scene; protected IDialogModule m_dialogMod; @@ -65,6 +66,8 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule m_scene = scene; m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove; m_dialogMod = m_scene.RequestModuleInterface(); + + m_log.DebugFormat("[DA EXAMPLE MODULE]: Added region {0}", m_scene.Name); } } @@ -91,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule if (sop == null) return true; - if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs)) + if (!sop.DynAttrs.TryGetStore(Namespace, StoreName, out attrs)) attrs = new OSDMap(); OSDInteger newValue; @@ -106,12 +109,14 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule attrs["moves"] = newValue; - sop.DynAttrs[DANamespace] = attrs; + sop.DynAttrs.SetStore(Namespace, StoreName, attrs); } sop.ParentGroup.HasGroupChanged = true; - m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); + string msg = string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue); + m_log.DebugFormat("[DA EXAMPLE MODULE]: {0}", msg); + m_dialogMod.SendGeneralAlert(msg); return true; } diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs index 650aa35..166a994 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs @@ -64,8 +64,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule private Scene m_scene; private IDialogModule m_dialogMod; - - public string Name { get { return "DOExample Module"; } } + + public string Name { get { return "DO"; } } public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule // Console.WriteLine("Here for {0}", so.Name); - if (rootPart.DynAttrs.TryGetValue(DAExampleModule.DANamespace, out attrs)) + if (rootPart.DynAttrs.TryGetStore(DAExampleModule.Namespace, DAExampleModule.StoreName, out attrs)) { movesSoFar = attrs["moves"].AsInteger(); @@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name); } - rootPart.DynObjs.Add(Name, new MyObject(movesSoFar)); + rootPart.DynObjs.Add(DAExampleModule.Namespace, Name, new MyObject(movesSoFar)); } private bool OnSceneGroupMove(UUID groupId, Vector3 delta) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index b4348c9..66059fb 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -144,7 +144,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests None 00000000-0000-0000-0000-000000000000 0 - MyStorethe answer42 + + + + MyNamespace + + MyStore + + the answer + 42 + + + + + @@ -333,7 +346,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests 0 2147483647 None - MyStorelast wordsRosebud + + + + MyNamespace + + MyStore + + last words + Rosebud + + + + + 00000000-0000-0000-0000-000000000000 @@ -362,7 +388,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); - OSDMap store = rootPart.DynAttrs["MyStore"]; + OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore"); Assert.AreEqual(42, store["the answer"].AsInteger()); // TODO: Check other properties @@ -414,13 +440,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests rp.CreatorID = rpCreatorId; rp.Shape = shape; + string daNamespace = "MyNamespace"; string daStoreName = "MyStore"; string daKey = "foo"; string daValue = "bar"; OSDMap myStore = new OSDMap(); myStore.Add(daKey, daValue); rp.DynAttrs = new DAMap(); - rp.DynAttrs[daStoreName] = myStore; + rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore); SceneObjectGroup so = new SceneObjectGroup(rp); @@ -481,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests Assert.That(name, Is.EqualTo(rpName)); Assert.That(creatorId, Is.EqualTo(rpCreatorId)); Assert.NotNull(daMap); - Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); + Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString()); } [Test] @@ -496,7 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); - OSDMap store = rootPart.DynAttrs["MyStore"]; + OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore"); Assert.AreEqual("Rosebud", store["last words"].AsString()); // TODO: Check other properties @@ -522,13 +549,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests rp.CreatorID = rpCreatorId; rp.Shape = shape; + string daNamespace = "MyNamespace"; string daStoreName = "MyStore"; string daKey = "foo"; string daValue = "bar"; OSDMap myStore = new OSDMap(); myStore.Add(daKey, daValue); rp.DynAttrs = new DAMap(); - rp.DynAttrs[daStoreName] = myStore; + rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore); SceneObjectGroup so = new SceneObjectGroup(rp); @@ -585,7 +613,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests Assert.That(name, Is.EqualTo(rpName)); Assert.That(creatorId, Is.EqualTo(rpCreatorId)); Assert.NotNull(daMap); - Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); + Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString()); } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3882b45..945745e 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1290,7 +1290,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); - if (sop.DynAttrs.Count > 0) + if (sop.DynAttrs.CountNamespaces > 0) { writer.WriteStartElement("DynAttrs"); sop.DynAttrs.WriteXml(writer); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 0e83781..586b59d 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -212,7 +212,6 @@ namespace OpenSim.Region.Framework.Scenes // } // } - /// /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps /// @@ -221,20 +220,23 @@ namespace OpenSim.Region.Framework.Scenes public void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) { // scan thru the dynAttrs map of this part for any textures used as materials - OSDMap OSMaterials = null; + OSD osdMaterials = null; lock (part.DynAttrs) { - if (part.DynAttrs.ContainsKey("OS:Materials")) - OSMaterials = part.DynAttrs["OS:Materials"]; - if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) + if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) + { + OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + materialsStore.TryGetValue("Materials", out osdMaterials); + } + + if (osdMaterials != null) { - OSD osd = OSMaterials["Materials"]; //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); - if (osd is OSDArray) + if (osdMaterials is OSDArray) { - OSDArray matsArr = osd as OSDArray; + OSDArray matsArr = osdMaterials as OSDArray; foreach (OSDMap matMap in matsArr) { try diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 4ab6609..5b15a73 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule void GetStoredMaterialsForPart(SceneObjectPart part) { - OSDMap OSMaterials = null; + OSD OSMaterials = null; OSDArray matsArr = null; if (part.DynAttrs == null) @@ -188,23 +188,20 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule lock (part.DynAttrs) { - if (part.DynAttrs.ContainsKey("OS:Materials")) - OSMaterials = part.DynAttrs["OS:Materials"]; - if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) + if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) { - - OSD osd = OSMaterials["Materials"]; - if (osd is OSDArray) - matsArr = osd as OSDArray; + OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + materialsStore.TryGetValue("Materials", out OSMaterials); } - } - if (OSMaterials == null) - return; + if (OSMaterials != null && OSMaterials is OSDArray) + matsArr = OSMaterials as OSDArray; + else + return; + } m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); - if (matsArr == null) { m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); @@ -215,7 +212,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule { if (elemOsd != null && elemOsd is OSDMap) { - OSDMap matMap = elemOsd as OSDMap; if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) { @@ -232,7 +228,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule } } - void StoreMaterialsForPart(SceneObjectPart part) { try @@ -277,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule OSMaterials["Materials"] = matsArr; lock (part.DynAttrs) - part.DynAttrs["OS:Materials"] = OSMaterials; + part.DynAttrs.SetStore("OpenSim", "Materials", OSMaterials); } catch (Exception e) { @@ -285,7 +280,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule } } - public string RenderMaterialsPostCap(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) -- cgit v1.1 From 149487ea0f74a46a70c98b3a31259b667f4d29b2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 27 Jun 2013 23:42:35 +0100 Subject: refactor: Move code for gathering textures referenced by materials into MaterialsDemoModule from UuidGatherer This code is now triggered via EventManager.OnGatherUuids which modules can subscribe to. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 31 ++++++++++ OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 69 +-------------------- .../Materials/MaterialsDemoModule.cs | 72 +++++++++++++++++++++- 3 files changed, 103 insertions(+), 69 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index a246319..720bfa9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1021,6 +1021,16 @@ namespace OpenSim.Region.Framework.Scenes /// public event TeleportFail OnTeleportFail; + public delegate void GatherUuids(SceneObjectPart sop, IDictionary assetUuids); + + /// + /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc. + /// + /// + /// The listener should add references to the IDictionary as appropriate. + /// + public event GatherUuids OnGatherUuids; + public class MoneyTransferArgs : EventArgs { public UUID sender; @@ -3237,5 +3247,26 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerGatherUuids(SceneObjectPart sop, IDictionary assetUuids) + { + GatherUuids handler = OnGatherUuids; + + if (handler != null) + { + foreach (GatherUuids d in handler.GetInvocationList()) + { + try + { + d(sop, assetUuids); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 586b59d..3492813 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -186,8 +186,7 @@ namespace OpenSim.Region.Framework.Scenes GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); } - // get any texture UUIDs used for materials such as normal and specular maps - GatherMaterialsUuids(part, assetUuids); + part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); } catch (Exception e) { @@ -211,71 +210,7 @@ namespace OpenSim.Region.Framework.Scenes // Monitor.Pulse(this); // } // } - - /// - /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps - /// - /// - /// - public void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) - { - // scan thru the dynAttrs map of this part for any textures used as materials - OSD osdMaterials = null; - - lock (part.DynAttrs) - { - if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) - { - OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); - materialsStore.TryGetValue("Materials", out osdMaterials); - } - - if (osdMaterials != null) - { - //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); - - if (osdMaterials is OSDArray) - { - OSDArray matsArr = osdMaterials as OSDArray; - foreach (OSDMap matMap in matsArr) - { - try - { - if (matMap.ContainsKey("Material")) - { - OSDMap mat = matMap["Material"] as OSDMap; - if (mat.ContainsKey("NormMap")) - { - UUID normalMapId = mat["NormMap"].AsUUID(); - if (normalMapId != UUID.Zero) - { - assetUuids[normalMapId] = AssetType.Texture; - //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); - } - } - if (mat.ContainsKey("SpecMap")) - { - UUID specularMapId = mat["SpecMap"].AsUUID(); - if (specularMapId != UUID.Zero) - { - assetUuids[specularMapId] = AssetType.Texture; - //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); - } - } - } - - } - catch (Exception e) - { - m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message); - } - } - } - } - } - } - - + /// /// Get an asset synchronously, potentially using an asynchronous callback. If the /// asynchronous callback is used, we will wait for it to complete. diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 5b15a73..e7b8928 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -121,9 +121,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule return; m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} ADDED", scene.RegionInfo.RegionName); + m_scene = scene; - m_scene.EventManager.OnRegisterCaps += new EventManager.RegisterCapsEvent(OnRegisterCaps); - m_scene.EventManager.OnObjectAddedToScene += new Action(EventManager_OnObjectAddedToScene); + m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; + m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; + m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids; } void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) @@ -157,6 +159,10 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule if (!m_enabled) return; + m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; + m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; + m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids; + m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName); } @@ -569,5 +575,67 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule output.Flush(); } + /// + /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps + /// + /// + /// + private void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) + { + // scan thru the dynAttrs map of this part for any textures used as materials + OSD osdMaterials = null; + + lock (part.DynAttrs) + { + if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) + { + OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + materialsStore.TryGetValue("Materials", out osdMaterials); + } + + if (osdMaterials != null) + { + //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); + + if (osdMaterials is OSDArray) + { + OSDArray matsArr = osdMaterials as OSDArray; + foreach (OSDMap matMap in matsArr) + { + try + { + if (matMap.ContainsKey("Material")) + { + OSDMap mat = matMap["Material"] as OSDMap; + if (mat.ContainsKey("NormMap")) + { + UUID normalMapId = mat["NormMap"].AsUUID(); + if (normalMapId != UUID.Zero) + { + assetUuids[normalMapId] = AssetType.Texture; + //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); + } + } + if (mat.ContainsKey("SpecMap")) + { + UUID specularMapId = mat["SpecMap"].AsUUID(); + if (specularMapId != UUID.Zero) + { + assetUuids[specularMapId] = AssetType.Texture; + //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); + } + } + } + + } + catch (Exception e) + { + m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message); + } + } + } + } + } + } } } \ No newline at end of file -- cgit v1.1 From c1b8f83dd4ad3e3c811a16b4b096edab7abccf8e Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 27 Jun 2013 17:53:15 -0700 Subject: test for null return from DynAttrs.GetStore() --- OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index e7b8928..be2d8da 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -590,6 +590,9 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) { OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + if (materialsStore == null) + return; + materialsStore.TryGetValue("Materials", out osdMaterials); } -- cgit v1.1 From d47fc48b3230b6d5cb555014d6242960cd397810 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 27 Jun 2013 18:01:17 -0700 Subject: and yet another check for null returned from DynAttrs.GetStore() --- OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index be2d8da..34dc552 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -197,6 +197,10 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) { OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + + if (materialsStore == null) + return; + materialsStore.TryGetValue("Materials", out OSMaterials); } -- cgit v1.1 From 529633d9707ee0df6b32e8dc692ab615e3563b63 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 27 Jun 2013 18:44:27 -0700 Subject: add method docs for DAMap.GetStore() and DAMap.SetStore() --- OpenSim/Framework/DAMap.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index a57393b..fd45a11 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -216,6 +216,12 @@ namespace OpenSim.Framework } } + /// + /// Retrieve a Dynamic Attribute store + /// + /// namespace for the store - use "OpenSim" for in-core modules + /// name of the store within the namespace + /// an OSDMap representing the stored data, or null if not found public OSDMap GetStore(string ns, string storeName) { OSD namespaceOsd; @@ -234,6 +240,12 @@ namespace OpenSim.Framework return null; } + /// + /// Saves a Dynamic attribute store + /// + /// namespace for the store - use "OpenSim" for in-core modules + /// name of the store within the namespace + /// an OSDMap representing the data to store public void SetStore(string ns, string storeName, OSDMap store) { ValidateNamespace(ns); -- cgit v1.1 From f6ce87c96d037787963d203346c5cb1a1dd52747 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Jun 2013 18:50:33 +0100 Subject: Reinsert code for gathering uuids reference by materials back directly into UuidGatherer for now. This cannot be triggered as an event from Scene.EventManager since some invocations of UuidGatherer (e.g. IAR saving) use scene objects which are not in scenes. There needs to be some way for modules to register for events which are not connected with a particular scene. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 58 ++++----- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 71 ++++++++++- .../Materials/MaterialsDemoModule.cs | 136 +++++++++++---------- 3 files changed, 168 insertions(+), 97 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 720bfa9..61b0ebd 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1021,15 +1021,15 @@ namespace OpenSim.Region.Framework.Scenes /// public event TeleportFail OnTeleportFail; - public delegate void GatherUuids(SceneObjectPart sop, IDictionary assetUuids); - - /// - /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc. - /// - /// - /// The listener should add references to the IDictionary as appropriate. - /// - public event GatherUuids OnGatherUuids; +// public delegate void GatherUuids(SceneObjectPart sop, IDictionary assetUuids); +// +// /// +// /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc. +// /// +// /// +// /// The listener should add references to the IDictionary as appropriate. +// /// +// public event GatherUuids OnGatherUuids; public class MoneyTransferArgs : EventArgs { @@ -3248,25 +3248,25 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerGatherUuids(SceneObjectPart sop, IDictionary assetUuids) - { - GatherUuids handler = OnGatherUuids; - - if (handler != null) - { - foreach (GatherUuids d in handler.GetInvocationList()) - { - try - { - d(sop, assetUuids); - } - catch (Exception e) - { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", - e.Message, e.StackTrace); - } - } - } - } +// public void TriggerGatherUuids(SceneObjectPart sop, IDictionary assetUuids) +// { +// GatherUuids handler = OnGatherUuids; +// +// if (handler != null) +// { +// foreach (GatherUuids d in handler.GetInvocationList()) +// { +// try +// { +// d(sop, assetUuids); +// } +// catch (Exception e) +// { +// m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", +// e.Message, e.StackTrace); +// } +// } +// } +// } } } diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 3492813..4e5fb8e 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -186,7 +186,13 @@ namespace OpenSim.Region.Framework.Scenes GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); } - part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); + // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed + // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and + // inventory transfer. There needs to be a way for a module to register a method without assuming a + // Scene.EventManager is present. +// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); + + GatherMaterialsUuids(part, assetUuids); } catch (Exception e) { @@ -210,6 +216,69 @@ namespace OpenSim.Region.Framework.Scenes // Monitor.Pulse(this); // } // } + + /// + /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps + /// + /// + /// + public void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) + { + // scan thru the dynAttrs map of this part for any textures used as materials + OSD osdMaterials = null; + + lock (part.DynAttrs) + { + if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) + { + OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + materialsStore.TryGetValue("Materials", out osdMaterials); + } + + if (osdMaterials != null) + { + //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); + + if (osdMaterials is OSDArray) + { + OSDArray matsArr = osdMaterials as OSDArray; + foreach (OSDMap matMap in matsArr) + { + try + { + if (matMap.ContainsKey("Material")) + { + OSDMap mat = matMap["Material"] as OSDMap; + if (mat.ContainsKey("NormMap")) + { + UUID normalMapId = mat["NormMap"].AsUUID(); + if (normalMapId != UUID.Zero) + { + assetUuids[normalMapId] = AssetType.Texture; + //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); + } + } + if (mat.ContainsKey("SpecMap")) + { + UUID specularMapId = mat["SpecMap"].AsUUID(); + if (specularMapId != UUID.Zero) + { + assetUuids[specularMapId] = AssetType.Texture; + //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); + } + } + } + + } + catch (Exception e) + { + m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message); + } + } + } + } + } + } /// /// Get an asset synchronously, potentially using an asynchronous callback. If the diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 34dc552..1cfbab0 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule m_scene = scene; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; - m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids; +// m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids; } void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) @@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; - m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids; +// m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids; m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName); } @@ -579,70 +579,72 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule output.Flush(); } - /// - /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps - /// - /// - /// - private void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) - { - // scan thru the dynAttrs map of this part for any textures used as materials - OSD osdMaterials = null; - - lock (part.DynAttrs) - { - if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) - { - OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); - if (materialsStore == null) - return; - - materialsStore.TryGetValue("Materials", out osdMaterials); - } - - if (osdMaterials != null) - { - //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); - - if (osdMaterials is OSDArray) - { - OSDArray matsArr = osdMaterials as OSDArray; - foreach (OSDMap matMap in matsArr) - { - try - { - if (matMap.ContainsKey("Material")) - { - OSDMap mat = matMap["Material"] as OSDMap; - if (mat.ContainsKey("NormMap")) - { - UUID normalMapId = mat["NormMap"].AsUUID(); - if (normalMapId != UUID.Zero) - { - assetUuids[normalMapId] = AssetType.Texture; - //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); - } - } - if (mat.ContainsKey("SpecMap")) - { - UUID specularMapId = mat["SpecMap"].AsUUID(); - if (specularMapId != UUID.Zero) - { - assetUuids[specularMapId] = AssetType.Texture; - //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); - } - } - } - - } - catch (Exception e) - { - m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message); - } - } - } - } - } - } + // FIXME: This code is currently still in UuidGatherer since we cannot use Scene.EventManager as some + // calls to the gatherer are done for objects with no scene. +// /// +// /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps +// /// +// /// +// /// +// private void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids) +// { +// // scan thru the dynAttrs map of this part for any textures used as materials +// OSD osdMaterials = null; +// +// lock (part.DynAttrs) +// { +// if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) +// { +// OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); +// if (materialsStore == null) +// return; +// +// materialsStore.TryGetValue("Materials", out osdMaterials); +// } +// +// if (osdMaterials != null) +// { +// //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); +// +// if (osdMaterials is OSDArray) +// { +// OSDArray matsArr = osdMaterials as OSDArray; +// foreach (OSDMap matMap in matsArr) +// { +// try +// { +// if (matMap.ContainsKey("Material")) +// { +// OSDMap mat = matMap["Material"] as OSDMap; +// if (mat.ContainsKey("NormMap")) +// { +// UUID normalMapId = mat["NormMap"].AsUUID(); +// if (normalMapId != UUID.Zero) +// { +// assetUuids[normalMapId] = AssetType.Texture; +// //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); +// } +// } +// if (mat.ContainsKey("SpecMap")) +// { +// UUID specularMapId = mat["SpecMap"].AsUUID(); +// if (specularMapId != UUID.Zero) +// { +// assetUuids[specularMapId] = AssetType.Texture; +// //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); +// } +// } +// } +// +// } +// catch (Exception e) +// { +// m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message); +// } +// } +// } +// } +// } +// } } } \ No newline at end of file -- cgit v1.1 From dc0455e217b8da3fc8bd49e959b57d6021312b77 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Jun 2013 19:11:44 +0100 Subject: In XAssetService, on a delete asset request also delete the asset in any chained service. This eliminates the async migration since it causes a race condition with the "delete asset" console command --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 2 ++ OpenSim/Services/AssetService/XAssetService.cs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 8c93825..91389ce 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -199,6 +199,8 @@ namespace OpenSim.Data.MySQL /// On failure : Throw an exception and attempt to reconnect to database public void StoreAsset(AssetBase asset) { +// m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID); + lock (m_dbLock) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index 8a2ca7c..6047616 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs @@ -205,15 +205,16 @@ namespace OpenSim.Services.AssetService if (!UUID.TryParse(id, out assetID)) return false; - // Don't bother deleting from a chained asset service. This isn't a big deal since deleting happens - // very rarely. + if (HasChainedAssetService) + m_ChainedAssetService.Delete(id); return m_Database.Delete(id); } private void MigrateFromChainedService(AssetBase asset) { - Util.FireAndForget(o => { Store(asset); m_ChainedAssetService.Delete(asset.ID); }); + Store(asset); + m_ChainedAssetService.Delete(asset.ID); } } } \ No newline at end of file -- cgit v1.1 From e26e8b882965430f66c6459987a8b219d68e5da1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Jun 2013 19:19:38 +0100 Subject: Remove "Asset deletion not supported by database" message from "delete asset" robust/standalone console command since it actually was implemented and performed. Improve other associated messages. --- OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index ff45d94..cc4325a 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -119,16 +119,14 @@ namespace OpenSim.Server.Handlers.Asset if (asset == null || asset.Data.Length == 0) { - MainConsole.Instance.Output("Asset not found"); + MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]); return; } - m_AssetService.Delete(args[2]); - - //MainConsole.Instance.Output("Asset deleted"); - // TODO: Implement this - - MainConsole.Instance.Output("Asset deletion not supported by database"); + if (!m_AssetService.Delete(asset.ID)) + MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); + else + MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name); } void HandleDumpAsset(string module, string[] args) -- cgit v1.1 From cbb51227296df9b158430d4a8adfcc96bdd55ed5 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 28 Jun 2013 14:00:28 -0700 Subject: add some locking to materials storage dictionary --- .../Materials/MaterialsDemoModule.cs | 72 +++++++++++++--------- 1 file changed, 42 insertions(+), 30 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 34dc552..19d8141 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs @@ -173,11 +173,14 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule OSDMap GetMaterial(UUID id) { OSDMap map = null; - if (m_knownMaterials.ContainsKey(id)) + lock (m_knownMaterials) { - map = new OSDMap(); - map["ID"] = OSD.FromBinary(id.GetBytes()); - map["Material"] = m_knownMaterials[id]; + if (m_knownMaterials.ContainsKey(id)) + { + map = new OSDMap(); + map["ID"] = OSD.FromBinary(id.GetBytes()); + map["Material"] = m_knownMaterials[id]; + } } return map; } @@ -227,7 +230,8 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule { try { - m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"]; + lock (m_knownMaterials) + m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"]; } catch (Exception e) { @@ -251,8 +255,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule if (te.DefaultTexture != null) { - if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID)) - mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID]; + lock (m_knownMaterials) + { + if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID)) + mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID]; + } } if (te.FaceTextures != null) @@ -261,8 +268,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule { if (face != null) { - if (m_knownMaterials.ContainsKey(face.MaterialID)) - mats[face.MaterialID] = m_knownMaterials[face.MaterialID]; + lock (m_knownMaterials) + { + if (m_knownMaterials.ContainsKey(face.MaterialID)) + mats[face.MaterialID] = m_knownMaterials[face.MaterialID]; + } } } } @@ -323,18 +333,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule try { UUID id = new UUID(elem.AsBinary(), 0); - - if (m_knownMaterials.ContainsKey(id)) + + lock (m_knownMaterials) { - m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString()); - OSDMap matMap = new OSDMap(); - matMap["ID"] = OSD.FromBinary(id.GetBytes()); + if (m_knownMaterials.ContainsKey(id)) + { + m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString()); + OSDMap matMap = new OSDMap(); + matMap["ID"] = OSD.FromBinary(id.GetBytes()); - matMap["Material"] = m_knownMaterials[id]; - respArr.Add(matMap); + matMap["Material"] = m_knownMaterials[id]; + respArr.Add(matMap); + } + else + m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString()); } - else - m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString()); } catch (Exception e) { @@ -372,7 +385,8 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule m_log.Debug("[MaterialsDemoModule]: mat: " + OSDParser.SerializeJsonString(mat)); UUID id = HashOsd(mat); - m_knownMaterials[id] = mat; + lock (m_knownMaterials) + m_knownMaterials[id] = mat; var sop = m_scene.GetSceneObjectPart(matLocalID); @@ -480,24 +494,22 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule m_log.Debug("[MaterialsDemoModule]: GET cap handler"); OSDMap resp = new OSDMap(); - - int matsCount = 0; - OSDArray allOsd = new OSDArray(); - foreach (KeyValuePair kvp in m_knownMaterials) + lock (m_knownMaterials) { - OSDMap matMap = new OSDMap(); - - matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes()); + foreach (KeyValuePair kvp in m_knownMaterials) + { + OSDMap matMap = new OSDMap(); - matMap["Material"] = kvp.Value; - allOsd.Add(matMap); - matsCount++; + matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes()); + matMap["Material"] = kvp.Value; + allOsd.Add(matMap); + matsCount++; + } } - resp["Zipped"] = ZCompressOSD(allOsd, false); m_log.Debug("[MaterialsDemoModule]: matsCount: " + matsCount.ToString()); -- cgit v1.1 From 371085546d93c610770abe1182e2add1d75cb16e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Jun 2013 23:57:41 +0100 Subject: Add materials store null check into UuidGatherer code. --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 4e5fb8e..8f69ce3 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -232,6 +232,10 @@ namespace OpenSim.Region.Framework.Scenes if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) { OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); + + if (materialsStore == null) + return; + materialsStore.TryGetValue("Materials", out osdMaterials); } -- cgit v1.1 From 3a634c56e344dcaa9bf089168bed185cee4527bf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 29 Jun 2013 00:23:41 +0100 Subject: Remove hack to migrate previous experimental-level os materials data. This didn't seem to be working anyway and it's better not to have such hacks in the code for experimental stuff. --- OpenSim/Framework/DAMap.cs | 9 --------- 1 file changed, 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index fd45a11..5c729e8 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -148,10 +148,6 @@ namespace OpenSim.Framework keysToRemove.Add(key); } - else if (key == "OS:Materials") - { - osMaterialsMigrationRequired = true; - } } if (keysToRemove != null) @@ -163,11 +159,6 @@ namespace OpenSim.Framework } } - // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should - // handle reading data from old locations - if (osMaterialsMigrationRequired) - daMap.SetStore("OpenSim", "Materials", (OSDMap)namespacesMap["OS:Materials"]); - foreach (OSD nsOsd in namespacesMap.Values) { OSDMap nsOsdMap = (OSDMap)nsOsd; -- cgit v1.1 From 00093a305d225c98ffe00b656df7943cb50c42b0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 18:35:23 -0700 Subject: Changed HG status notifications timeout down to 15secs from the default 100. --- OpenSim/Framework/WebUtil.cs | 10 +++++++++- .../Connectors/Hypergrid/HGFriendsServicesConnector.cs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 4599f62..6fb1e0c 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -962,11 +962,12 @@ namespace OpenSim.Framework /// /// /// + /// /// /// /// Thrown if we encounter a network issue while posting /// the request. You'll want to make sure you deal with this as they're not uncommon - public static string MakeRequest(string verb, string requestUrl, string obj) + public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) { int reqnum = WebUtil.RequestNumber++; @@ -980,6 +981,8 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + if (timeoutsecs > 0) + request.Timeout = timeoutsecs * 1000; string respstring = String.Empty; using (MemoryStream buffer = new MemoryStream()) @@ -1073,6 +1076,11 @@ namespace OpenSim.Framework return respstring; } + + public static string MakeRequest(string verb, string requestUrl, string obj) + { + return MakeRequest(verb, requestUrl, obj, -1); + } } public class SynchronousRestObjectRequester diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs index e984a54..622d4e1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs @@ -277,7 +277,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, - ServerUtils.BuildQueryString(sendData)); + ServerUtils.BuildQueryString(sendData), 15); } catch (Exception e) { -- cgit v1.1 From ff47cf77ab52d42195fb0f089599618511d4919b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 19:15:25 -0700 Subject: A little more debug for the Unknown User problem mantis #6625 --- .../Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs index 4dca592..1db4ad0 100644 --- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs +++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs @@ -103,6 +103,9 @@ namespace OpenSim.Capabilities.Handlers p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower(); p.id = user.Id; p.is_display_name_default = false; + + if (user.FirstName.StartsWith("Unknown") && user.LastName.StartsWith("User")) + m_log.DebugFormat("[AVATAR PICKER SEARCH]: Sending {0} {1}", user.FirstName, user.LastName); return p; } -- cgit v1.1 From 0c9702156581cd3948fe07bdae23f3530105d2b5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 21:05:45 -0700 Subject: More debug for mantis #6625. It looks like the home friends list is being fetched on HG TPs. --- .../CoreModules/Avatar/Friends/HGFriendsModule.cs | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index b3e3aa2..ae45b99 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -183,6 +183,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) { IUserManagement uMan = m_Scenes[0].RequestModuleInterface(); + m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend); uMan.AddUser(id, url + ";" + first + " " + last); } } @@ -347,31 +348,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return null; } - public override FriendInfo[] GetFriendsFromService(IClientAPI client) - { -// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); - Boolean agentIsLocal = true; - if (UserManagementModule != null) - agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); +// public override FriendInfo[] GetFriendsFromService(IClientAPI client) +// { +//// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); +// Boolean agentIsLocal = true; +// if (UserManagementModule != null) +// agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); - if (agentIsLocal) - return base.GetFriendsFromService(client); +// if (agentIsLocal) +// return base.GetFriendsFromService(client); - FriendInfo[] finfos = new FriendInfo[0]; - // Foreigner - AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); - if (agentClientCircuit != null) - { - //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); +// FriendInfo[] finfos = new FriendInfo[0]; +// // Foreigner +// AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); +// if (agentClientCircuit != null) +// { +// //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); - finfos = FriendsService.GetFriends(client.AgentId.ToString()); - m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); - } +// finfos = FriendsService.GetFriends(client.AgentId.ToString()); +// m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); +// } -// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); +//// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); - return finfos; - } +// return finfos; +// } protected override bool StoreRights(UUID agentID, UUID friendID, int rights) { -- cgit v1.1 From 8fa5d12fcb73ffcc7144009e0147febcfa3ce704 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 21:26:58 -0700 Subject: One more debug mantis #6625 --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 41ea2a2..50371ce 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -292,6 +292,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends friendsData = new UserFriendData(); friendsData.PrincipalID = agentID; friendsData.Friends = GetFriendsFromService(client); + m_log.DebugFormat("[FRIENDS MODULE]: User has {1} friends", friendsData.Friends.Length); friendsData.Refcount = 1; m_Friends[agentID] = friendsData; -- cgit v1.1 From c462e0a51ce04a580eab49df6c679c20eff74c8d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 21:30:07 -0700 Subject: Fixed previous debug message --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 50371ce..d9d302c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -292,7 +292,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends friendsData = new UserFriendData(); friendsData.PrincipalID = agentID; friendsData.Friends = GetFriendsFromService(client); - m_log.DebugFormat("[FRIENDS MODULE]: User has {1} friends", friendsData.Friends.Length); + m_log.DebugFormat("[FRIENDS MODULE]: User has {0} friends", friendsData.Friends.Length); friendsData.Refcount = 1; m_Friends[agentID] = friendsData; -- cgit v1.1 From 20f2cf876982b2c7589b67ce4c8f09d8fff3e9f1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 21:54:10 -0700 Subject: More debug mantis #6625 --- OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b1dd84e..1e6ff7e 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs @@ -112,6 +112,7 @@ namespace OpenSim.Services.Connectors.Friends try { + m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Calling {0}", uri); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { -- cgit v1.1 From 74e7fac13fcb5d15d469d27694fc89d5f784ade0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 29 Jun 2013 22:32:26 -0700 Subject: More on mantis #6625 --- .../ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 2d3ba82..70ba944 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -204,7 +204,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory Util.FireAndForget(delegate { foreach (InventoryItemBase item in items) - UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + if (!string.IsNullOrEmpty(item.CreatorData)) + UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); }); } -- cgit v1.1 From 1fc873d09fbc0d29e35d2a8f34c134bb8ac01480 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Jun 2013 07:21:22 -0700 Subject: Same fix to LocalInventoryServiceConnector.cs --- .../ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index ec5751d..99913a9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -196,7 +196,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory Util.FireAndForget(delegate { foreach (InventoryItemBase item in items) - UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + if (!string.IsNullOrEmpty(item.CreatorData)) + UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); }); } -- cgit v1.1 From d7775d1e113560307af0170f8d2eab628a5e8acb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Jun 2013 07:22:27 -0700 Subject: Revert "A little more debug for the Unknown User problem mantis #6625" This reverts commit ff47cf77ab52d42195fb0f089599618511d4919b. --- .../Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs index 1db4ad0..4dca592 100644 --- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs +++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs @@ -103,9 +103,6 @@ namespace OpenSim.Capabilities.Handlers p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower(); p.id = user.Id; p.is_display_name_default = false; - - if (user.FirstName.StartsWith("Unknown") && user.LastName.StartsWith("User")) - m_log.DebugFormat("[AVATAR PICKER SEARCH]: Sending {0} {1}", user.FirstName, user.LastName); return p; } -- cgit v1.1 From 1e97972f78a852f24664f730f2e502c3b8a680c8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Jun 2013 07:25:13 -0700 Subject: Revert "One more debug mantis #6625" This reverts commit 8fa5d12fcb73ffcc7144009e0147febcfa3ce704. Conflicts: OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index d9d302c..41ea2a2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -292,7 +292,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends friendsData = new UserFriendData(); friendsData.PrincipalID = agentID; friendsData.Friends = GetFriendsFromService(client); - m_log.DebugFormat("[FRIENDS MODULE]: User has {0} friends", friendsData.Friends.Length); friendsData.Refcount = 1; m_Friends[agentID] = friendsData; -- cgit v1.1 From c7383688466ec61623c709800486de90240fc2d7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Jun 2013 07:25:46 -0700 Subject: Revert "More debug mantis #6625" This reverts commit 20f2cf876982b2c7589b67ce4c8f09d8fff3e9f1. --- OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index 1e6ff7e..b1dd84e 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs @@ -112,7 +112,6 @@ namespace OpenSim.Services.Connectors.Friends try { - m_log.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Calling {0}", uri); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { -- cgit v1.1 From e377abcc35c5fb4d47418524ae68364705995915 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Jun 2013 08:39:35 -0700 Subject: Groups V2: charge for group creation only after the group has been successfully created --- OpenSim/Addons/Groups/GroupsModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 5b3b9f6..5959bac 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -766,14 +766,17 @@ namespace OpenSim.Groups remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); return UUID.Zero; } - money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); } + string reason = string.Empty; UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId, out reason); if (groupID != UUID.Zero) { + if (money != null) + money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); + remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); // Update the founder with new group information. -- cgit v1.1