diff options
author | Melanie | 2009-12-12 04:14:12 +0000 |
---|---|---|
committer | Melanie | 2009-12-12 04:14:12 +0000 |
commit | 83ca7db4b85641b8bfbfeab6cb9b1c3157fcf67f (patch) | |
tree | a3b7f1def00f4365254b3e5c3c6eebd0a0c6c7a9 /OpenSim/Region | |
parent | Getting rid of a bunch of old classes, that are likely left over from the ROB... (diff) | |
parent | A few more guards along the path to user server. (diff) | |
download | opensim-SC_OLD-83ca7db4b85641b8bfbfeab6cb9b1c3157fcf67f.zip opensim-SC_OLD-83ca7db4b85641b8bfbfeab6cb9b1c3157fcf67f.tar.gz opensim-SC_OLD-83ca7db4b85641b8bfbfeab6cb9b1c3157fcf67f.tar.bz2 opensim-SC_OLD-83ca7db4b85641b8bfbfeab6cb9b1c3157fcf67f.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
3 files changed, 77 insertions, 4 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs index 2f9a45f..776d5d1 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs | |||
@@ -655,9 +655,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
655 | userData.Email = (string)data["email"]; | 655 | userData.Email = (string)data["email"]; |
656 | userData.ID = new UUID((string)data["uuid"]); | 656 | userData.ID = new UUID((string)data["uuid"]); |
657 | userData.Created = Convert.ToInt32(data["profile_created"]); | 657 | userData.Created = Convert.ToInt32(data["profile_created"]); |
658 | userData.UserInventoryURI = (string)data["server_inventory"]; | 658 | if (data.Contains("server_inventory") && data["server_inventory"] != null) |
659 | userData.UserAssetURI = (string)data["server_asset"]; | 659 | userData.UserInventoryURI = (string)data["server_inventory"]; |
660 | userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; | 660 | if (data.Contains("server_asset") && data["server_asset"] != null) |
661 | userData.UserAssetURI = (string)data["server_asset"]; | ||
662 | if (data.Contains("profile_firstlife_about") && data["profile_firstlife_about"] != null) | ||
663 | userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; | ||
661 | userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); | 664 | userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); |
662 | userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); | 665 | userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); |
663 | userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); | 666 | userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index f2d8579..4d347cd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | |||
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
155 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); | 155 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); |
156 | 156 | ||
157 | // Yikes!! Remove this as soon as user services get refactored | 157 | // Yikes!! Remove this as soon as user services get refactored |
158 | LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.UserURL; | 158 | LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.AssetURL; |
159 | LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL; | 159 | LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL; |
160 | LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL; | 160 | LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL; |
161 | HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); | 161 | HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); |
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 9639095..76dac61 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -45,6 +45,10 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | private bool m_stale = true; | 46 | private bool m_stale = true; |
47 | 47 | ||
48 | private static UUID m_DefaultImage = new UUID("89556747-24cb-43ed-920b-47caed15465f"); | ||
49 | private static UUID m_BlankImage = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
50 | |||
51 | |||
48 | public void Initialize(Scene scene, DataSnapshotManager parent) | 52 | public void Initialize(Scene scene, DataSnapshotManager parent) |
49 | { | 53 | { |
50 | m_scene = scene; | 54 | m_scene = scene; |
@@ -142,6 +146,19 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
142 | node.InnerText = land.LandData.GlobalID.ToString(); | 146 | node.InnerText = land.LandData.GlobalID.ToString(); |
143 | xmlobject.AppendChild(node); | 147 | xmlobject.AppendChild(node); |
144 | 148 | ||
149 | node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); | ||
150 | Vector3 loc = obj.AbsolutePosition; | ||
151 | node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); | ||
152 | xmlobject.AppendChild(node); | ||
153 | |||
154 | string bestImage = GuessImage(obj); | ||
155 | if (bestImage != string.Empty) | ||
156 | { | ||
157 | node = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); | ||
158 | node.InnerText = bestImage; | ||
159 | xmlobject.AppendChild(node); | ||
160 | } | ||
161 | |||
145 | parent.AppendChild(xmlobject); | 162 | parent.AppendChild(xmlobject); |
146 | } | 163 | } |
147 | } | 164 | } |
@@ -173,5 +190,58 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
173 | } | 190 | } |
174 | 191 | ||
175 | public event ProviderStale OnStale; | 192 | public event ProviderStale OnStale; |
193 | |||
194 | /// <summary> | ||
195 | /// Guesses the best image, based on a simple heuristic. It guesses only for boxes. | ||
196 | /// We're optimizing for boxes, because those are the most common objects | ||
197 | /// marked "Show in search" -- boxes with content inside.For other shapes, | ||
198 | /// it's really hard to tell which texture should be grabbed. | ||
199 | /// </summary> | ||
200 | /// <param name="sog"></param> | ||
201 | /// <returns></returns> | ||
202 | private string GuessImage(SceneObjectGroup sog) | ||
203 | { | ||
204 | string bestguess = string.Empty; | ||
205 | Dictionary<UUID, int> counts = new Dictionary<UUID, int>(); | ||
206 | if (sog.RootPart.Shape != null && sog.RootPart.Shape.ProfileShape == ProfileShape.Square && | ||
207 | sog.RootPart.Shape.Textures != null && sog.RootPart.Shape.Textures.FaceTextures != null) | ||
208 | { | ||
209 | if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero && | ||
210 | sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage && | ||
211 | sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage && | ||
212 | sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50) | ||
213 | { | ||
214 | counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8; | ||
215 | } | ||
216 | |||
217 | foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures) | ||
218 | { | ||
219 | if (tentry != null) | ||
220 | { | ||
221 | if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50) | ||
222 | { | ||
223 | int c = 0; | ||
224 | counts.TryGetValue(tentry.TextureID, out c); | ||
225 | counts[tentry.TextureID] = c + 1; | ||
226 | // decrease the default texture count | ||
227 | if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID)) | ||
228 | counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | // Let's pick the most unique texture | ||
234 | int min = 9999; | ||
235 | foreach (KeyValuePair<UUID, int> kv in counts) | ||
236 | { | ||
237 | if (kv.Value < min && kv.Value >= 1) | ||
238 | { | ||
239 | bestguess = kv.Key.ToString(); | ||
240 | min = kv.Value; | ||
241 | } | ||
242 | } | ||
243 | } | ||
244 | return bestguess; | ||
245 | } | ||
176 | } | 246 | } |
177 | } | 247 | } |