diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
15 files changed, 223 insertions, 151 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index faa413e..7200c4b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -143,7 +143,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
143 | } | 143 | } |
144 | catch (Exception e) | 144 | catch (Exception e) |
145 | { | 145 | { |
146 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); | 146 | UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId; |
147 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}", | ||
148 | attach.ItemID, attach.AssetID, p, agentId, e.Message, e.StackTrace); | ||
147 | } | 149 | } |
148 | } | 150 | } |
149 | } | 151 | } |
@@ -389,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
389 | lock (sp.AttachmentsSyncLock) | 391 | lock (sp.AttachmentsSyncLock) |
390 | { | 392 | { |
391 | // Save avatar attachment information | 393 | // Save avatar attachment information |
392 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); | 394 | // m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); |
393 | 395 | ||
394 | bool changed = sp.Appearance.DetachAttachment(itemID); | 396 | bool changed = sp.Appearance.DetachAttachment(itemID); |
395 | if (changed && m_scene.AvatarFactory != null) | 397 | if (changed && m_scene.AvatarFactory != null) |
@@ -469,9 +471,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
469 | 471 | ||
470 | if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) | 472 | if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) |
471 | { | 473 | { |
472 | m_log.DebugFormat( | 474 | // m_log.DebugFormat( |
473 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | 475 | // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", |
474 | grp.UUID, grp.AttachmentPoint); | 476 | // grp.UUID, grp.AttachmentPoint); |
475 | 477 | ||
476 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 478 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
477 | 479 | ||
@@ -502,12 +504,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
502 | } | 504 | } |
503 | grp.HasGroupChanged = false; // Prevent it being saved over and over | 505 | grp.HasGroupChanged = false; // Prevent it being saved over and over |
504 | } | 506 | } |
505 | else | 507 | // else |
506 | { | 508 | // { |
507 | m_log.DebugFormat( | 509 | // m_log.DebugFormat( |
508 | "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", | 510 | // "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", |
509 | grp.UUID, grp.AttachmentPoint); | 511 | // grp.UUID, grp.AttachmentPoint); |
510 | } | 512 | // } |
511 | } | 513 | } |
512 | 514 | ||
513 | /// <summary> | 515 | /// <summary> |
@@ -889,13 +891,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
889 | // Calls attach with a Zero position | 891 | // Calls attach with a Zero position |
890 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) | 892 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) |
891 | { | 893 | { |
892 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); | 894 | // m_log.Debug( |
895 | // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
896 | // + ", AttachmentPoint: " + AttachmentPt); | ||
893 | 897 | ||
894 | // Save avatar attachment information | 898 | // Save avatar attachment information |
895 | m_log.Debug( | 899 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); |
896 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
897 | + ", AttachmentPoint: " + AttachmentPt); | ||
898 | |||
899 | } | 900 | } |
900 | } | 901 | } |
901 | catch (Exception e) | 902 | catch (Exception e) |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b0cee03..0ed10d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
158 | // Process the baked texture array | 158 | // Process the baked texture array |
159 | if (textureEntry != null) | 159 | if (textureEntry != null) |
160 | { | 160 | { |
161 | m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); | 161 | // m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); |
162 | 162 | ||
163 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); | 163 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); |
164 | 164 | ||
@@ -208,7 +208,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
208 | ScenePresence sp = m_scene.GetScenePresence(agentId); | 208 | ScenePresence sp = m_scene.GetScenePresence(agentId); |
209 | if (sp == null) | 209 | if (sp == null) |
210 | { | 210 | { |
211 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); | 211 | // This is expected if the user has gone away. |
212 | // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); | ||
212 | return false; | 213 | return false; |
213 | } | 214 | } |
214 | 215 | ||
@@ -248,10 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
248 | 249 | ||
249 | if (bakedTextureFace == null) | 250 | if (bakedTextureFace == null) |
250 | { | 251 | { |
251 | m_log.WarnFormat( | 252 | // This can happen legitimately, since some baked textures might not exist |
252 | "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", | 253 | //m_log.WarnFormat( |
253 | bakeType, sp.Name, m_scene.RegionInfo.RegionName); | 254 | // "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", |
254 | 255 | // bakeType, sp.Name, m_scene.RegionInfo.RegionName); | |
255 | continue; | 256 | continue; |
256 | } | 257 | } |
257 | 258 | ||
@@ -337,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
337 | return false; | 338 | return false; |
338 | } | 339 | } |
339 | 340 | ||
340 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); | 341 | // m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); |
341 | 342 | ||
342 | // If we only found default textures, then the appearance is not cached | 343 | // If we only found default textures, then the appearance is not cached |
343 | return (defonly ? false : true); | 344 | return (defonly ? false : true); |
@@ -417,7 +418,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
417 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | 418 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); |
418 | 419 | ||
419 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); | 420 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); |
420 | bakedTextures[bakeType] = faceTextures[ftIndex]; | 421 | Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture |
422 | bakedTextures[bakeType] = texture; | ||
421 | } | 423 | } |
422 | 424 | ||
423 | return bakedTextures; | 425 | return bakedTextures; |
@@ -482,7 +484,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
482 | ScenePresence sp = m_scene.GetScenePresence(agentid); | 484 | ScenePresence sp = m_scene.GetScenePresence(agentid); |
483 | if (sp == null) | 485 | if (sp == null) |
484 | { | 486 | { |
485 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); | 487 | // This is expected if the user has gone away. |
488 | // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); | ||
486 | return; | 489 | return; |
487 | } | 490 | } |
488 | 491 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 10b4c37..e4452fb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
186 | { | 186 | { |
187 | string fromName = c.From; | 187 | string fromName = c.From; |
188 | UUID fromID = UUID.Zero; | 188 | UUID fromID = UUID.Zero; |
189 | UUID targetID = c.TargetUUID; | ||
189 | string message = c.Message; | 190 | string message = c.Message; |
190 | IScene scene = c.Scene; | 191 | IScene scene = c.Scene; |
191 | Vector3 fromPos = c.Position; | 192 | Vector3 fromPos = c.Position; |
@@ -221,24 +222,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
221 | message = message.Substring(0, 1000); | 222 | message = message.Substring(0, 1000); |
222 | 223 | ||
223 | // m_log.DebugFormat( | 224 | // m_log.DebugFormat( |
224 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", | 225 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}", |
225 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); | 226 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID); |
226 | 227 | ||
227 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); | 228 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); |
228 | 229 | ||
229 | foreach (Scene s in m_scenes) | 230 | foreach (Scene s in m_scenes) |
230 | { | 231 | { |
231 | // This should use ForEachClient, but clients don't have a position. | 232 | if (targetID == UUID.Zero) |
232 | // If camera is moved into client, then camera position can be used | 233 | { |
233 | s.ForEachRootScenePresence( | 234 | // This should use ForEachClient, but clients don't have a position. |
234 | delegate(ScenePresence presence) | 235 | // If camera is moved into client, then camera position can be used |
236 | s.ForEachRootScenePresence( | ||
237 | delegate(ScenePresence presence) | ||
238 | { | ||
239 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) | ||
240 | receiverIDs.Add(presence.UUID); | ||
241 | } | ||
242 | ); | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | // This is a send to a specific client eg from llRegionSayTo | ||
247 | // no need to check distance etc, jand send is as say | ||
248 | ScenePresence presence = s.GetScenePresence(targetID); | ||
249 | if (presence != null && !presence.IsChildAgent) | ||
235 | { | 250 | { |
236 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType)) | 251 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true)) |
237 | receiverIDs.Add(presence.UUID); | 252 | receiverIDs.Add(presence.UUID); |
238 | } | 253 | } |
239 | ); | 254 | } |
240 | } | 255 | } |
241 | 256 | ||
242 | (scene as Scene).EventManager.TriggerOnChatToClients( | 257 | (scene as Scene).EventManager.TriggerOnChatToClients( |
243 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); | 258 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); |
244 | } | 259 | } |
@@ -315,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
315 | /// precondition</returns> | 330 | /// precondition</returns> |
316 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 331 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
317 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 332 | UUID fromAgentID, string fromName, ChatTypeEnum type, |
318 | string message, ChatSourceType src) | 333 | string message, ChatSourceType src, bool ignoreDistance) |
319 | { | 334 | { |
320 | // don't send stuff to child agents | 335 | // don't send stuff to child agents |
321 | if (presence.IsChildAgent) return false; | 336 | if (presence.IsChildAgent) return false; |
@@ -326,12 +341,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
326 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 341 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
327 | 342 | ||
328 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); | 343 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); |
329 | 344 | ||
330 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || | 345 | if (!ignoreDistance) |
331 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
332 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
333 | { | 346 | { |
334 | return false; | 347 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || |
348 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
349 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
350 | { | ||
351 | return false; | ||
352 | } | ||
335 | } | 353 | } |
336 | 354 | ||
337 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 355 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d295384..2d4cffd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
151 | Scene scene = (Scene)(client.Scene); | 151 | Scene scene = (Scene)(client.Scene); |
152 | ScenePresence presence = scene.GetScenePresence(client.AgentId); | 152 | ScenePresence presence = scene.GetScenePresence(client.AgentId); |
153 | 153 | ||
154 | // Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given | ||
155 | // a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on | ||
156 | // arrival. | ||
157 | // | ||
158 | // Ideally we would give the exact float position adjusting for the relative height of the two avatars | ||
159 | // but it looks like a float component isn't possible with a parcel ID. | ||
154 | UUID dest = Util.BuildFakeParcelID( | 160 | UUID dest = Util.BuildFakeParcelID( |
155 | scene.RegionInfo.RegionHandle, | 161 | scene.RegionInfo.RegionHandle, |
156 | (uint)presence.AbsolutePosition.X, | 162 | (uint)presence.AbsolutePosition.X, |
157 | (uint)presence.AbsolutePosition.Y, | 163 | (uint)presence.AbsolutePosition.Y, |
158 | (uint)presence.AbsolutePosition.Z); | 164 | (uint)Math.Ceiling(presence.AbsolutePosition.Z)); |
159 | 165 | ||
160 | m_log.DebugFormat("TP invite with message {0}", message); | 166 | m_log.DebugFormat("TP invite with message {0}", message); |
161 | 167 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fa9cd55..a36d0fe 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
61 | set { m_MaxTransferDistance = value; } | 61 | set { m_MaxTransferDistance = value; } |
62 | } | 62 | } |
63 | 63 | ||
64 | private int m_levelHGTeleport = 0; | ||
65 | |||
66 | protected bool m_Enabled = false; | 64 | protected bool m_Enabled = false; |
67 | protected Scene m_aScene; | 65 | protected Scene m_aScene; |
68 | protected List<Scene> m_Scenes = new List<Scene>(); | 66 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
106 | if (transferConfig != null) | 104 | if (transferConfig != null) |
107 | { | 105 | { |
108 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | 106 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); |
109 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | ||
110 | } | 107 | } |
111 | 108 | ||
112 | m_agentsInTransit = new List<UUID>(); | 109 | m_agentsInTransit = new List<UUID>(); |
@@ -172,13 +169,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
172 | // Reset animations; the viewer does that in teleports. | 169 | // Reset animations; the viewer does that in teleports. |
173 | sp.Animator.ResetAnimations(); | 170 | sp.Animator.ResetAnimations(); |
174 | 171 | ||
172 | string destinationRegionName = "(not found)"; | ||
173 | |||
175 | try | 174 | try |
176 | { | 175 | { |
177 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) | 176 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) |
178 | { | 177 | { |
178 | destinationRegionName = sp.Scene.RegionInfo.RegionName; | ||
179 | |||
179 | m_log.DebugFormat( | 180 | m_log.DebugFormat( |
180 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}", | 181 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation for {0} to {1} within existing region {2}", |
181 | position, sp.Scene.RegionInfo.RegionName); | 182 | sp.Name, position, destinationRegionName); |
182 | 183 | ||
183 | // Teleport within the same region | 184 | // Teleport within the same region |
184 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | 185 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) |
@@ -188,6 +189,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
188 | m_log.WarnFormat( | 189 | m_log.WarnFormat( |
189 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 190 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
190 | position, sp.Name, sp.UUID, emergencyPos); | 191 | position, sp.Name, sp.UUID, emergencyPos); |
192 | |||
191 | position = emergencyPos; | 193 | position = emergencyPos; |
192 | } | 194 | } |
193 | 195 | ||
@@ -210,6 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 212 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
211 | 213 | ||
212 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 214 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
215 | sp.Velocity = Vector3.Zero; | ||
213 | sp.Teleport(position); | 216 | sp.Teleport(position); |
214 | 217 | ||
215 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 218 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
@@ -233,15 +236,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
233 | return; | 236 | return; |
234 | } | 237 | } |
235 | 238 | ||
236 | // check if HyperGrid teleport is allowed, based on user level | 239 | destinationRegionName = finalDestination.RegionName; |
237 | int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID); | ||
238 | |||
239 | if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport)) | ||
240 | { | ||
241 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent."); | ||
242 | sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted"); | ||
243 | return; | ||
244 | } | ||
245 | 240 | ||
246 | uint curX = 0, curY = 0; | 241 | uint curX = 0, curY = 0; |
247 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | 242 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); |
@@ -307,7 +302,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
307 | } | 302 | } |
308 | catch (Exception e) | 303 | catch (Exception e) |
309 | { | 304 | { |
310 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace); | 305 | m_log.ErrorFormat( |
306 | "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", | ||
307 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, | ||
308 | e.Message, e.StackTrace); | ||
309 | |||
311 | sp.ControllingClient.SendTeleportFailed("Internal error"); | 310 | sp.ControllingClient.SendTeleportFailed("Internal error"); |
312 | } | 311 | } |
313 | } | 312 | } |
@@ -402,7 +401,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
402 | bool logout = false; | 401 | bool logout = false; |
403 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 402 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
404 | { | 403 | { |
405 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", | 404 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", |
406 | reason)); | 405 | reason)); |
407 | return; | 406 | return; |
408 | } | 407 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7f9175d..634fb43 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private bool m_Initialized = false; | 52 | private bool m_Initialized = false; |
53 | private int m_levelHGTeleport = 0; | ||
53 | 54 | ||
54 | private GatekeeperServiceConnector m_GatekeeperConnector; | 55 | private GatekeeperServiceConnector m_GatekeeperConnector; |
55 | 56 | ||
@@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
68 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 69 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
69 | if (name == Name) | 70 | if (name == Name) |
70 | { | 71 | { |
72 | IConfig transferConfig = source.Configs["EntityTransfer"]; | ||
73 | if (transferConfig != null) | ||
74 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | ||
75 | |||
71 | InitialiseCommon(source); | 76 | InitialiseCommon(source); |
72 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 77 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
73 | } | 78 | } |
@@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
164 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 169 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
165 | { | 170 | { |
166 | // this user is going to another grid | 171 | // this user is going to another grid |
172 | // check if HyperGrid teleport is allowed, based on user level | ||
173 | if (sp.UserLevel < m_levelHGTeleport) | ||
174 | { | ||
175 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); | ||
176 | reason = "HyperGrid teleport not permitted"; | ||
177 | return false; | ||
178 | } | ||
179 | |||
167 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) | 180 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) |
168 | { | 181 | { |
169 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); | 182 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 176c86d..8358bc0 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -308,56 +308,56 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
308 | /// <param name='msg'> | 308 | /// <param name='msg'> |
309 | /// Message. | 309 | /// Message. |
310 | /// </param> | 310 | /// </param> |
311 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) | 311 | public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg) |
312 | { | 312 | { |
313 | error = null; | ||
314 | // Is id an avatar? | 313 | // Is id an avatar? |
315 | ScenePresence sp = m_scene.GetScenePresence(target); | 314 | ScenePresence sp = m_scene.GetScenePresence(target); |
316 | 315 | ||
317 | if (sp != null) | 316 | if (sp != null) |
318 | { | 317 | { |
319 | // Send message to avatar | 318 | // ignore if a child agent this is restricted to inside one region |
319 | if (sp.IsChildAgent) | ||
320 | return; | ||
321 | |||
322 | // Send message to the avatar. | ||
323 | // Channel zero only goes to the avatar | ||
324 | // non zero channel messages only go to the attachments | ||
320 | if (channel == 0) | 325 | if (channel == 0) |
321 | { | 326 | { |
322 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false); | 327 | m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false); |
323 | } | 328 | } |
324 | 329 | else | |
325 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | ||
326 | |||
327 | if (attachments.Count == 0) | ||
328 | return true; | ||
329 | |||
330 | // Get uuid of attachments | ||
331 | List<UUID> targets = new List<UUID>(); | ||
332 | foreach (SceneObjectGroup sog in attachments) | ||
333 | { | 330 | { |
334 | if (!sog.IsDeleted) | 331 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
335 | targets.Add(sog.UUID); | 332 | if (attachments.Count == 0) |
336 | } | 333 | return; |
337 | 334 | ||
338 | // Need to check each attachment | 335 | // Get uuid of attachments |
339 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 336 | List<UUID> targets = new List<UUID>(); |
340 | { | 337 | foreach (SceneObjectGroup sog in attachments) |
341 | if (li.GetHostID().Equals(id)) | 338 | { |
342 | continue; | 339 | if (!sog.IsDeleted) |
340 | targets.Add(sog.UUID); | ||
341 | } | ||
343 | 342 | ||
344 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | 343 | // Need to check each attachment |
345 | continue; | 344 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
345 | { | ||
346 | if (li.GetHostID().Equals(id)) | ||
347 | continue; | ||
346 | 348 | ||
347 | if (targets.Contains(li.GetHostID())) | 349 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) |
348 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 350 | continue; |
349 | } | ||
350 | 351 | ||
351 | return true; | 352 | if (targets.Contains(li.GetHostID())) |
352 | } | 353 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
354 | } | ||
355 | } | ||
353 | 356 | ||
354 | // Need to toss an error here | 357 | return; |
355 | if (channel == 0) | ||
356 | { | ||
357 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
358 | return false; | ||
359 | } | 358 | } |
360 | 359 | ||
360 | // No avatar found so look for an object | ||
361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
362 | { | 362 | { |
363 | // Dont process if this message is from yourself! | 363 | // Dont process if this message is from yourself! |
@@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | return true; | 378 | return; |
379 | } | 379 | } |
380 | 380 | ||
381 | protected void QueueMessage(ListenerInfo li) | 381 | protected void QueueMessage(ListenerInfo li) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 63f1363..e05e8f6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
102 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 102 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
103 | Vector3 groupPosition = new Vector3(10, 20, 30); | 103 | Vector3 groupPosition = new Vector3(10, 20, 30); |
104 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 104 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
105 | Vector3 offsetPosition = new Vector3(5, 10, 15); | 105 | // Vector3 offsetPosition = new Vector3(5, 10, 15); |
106 | 106 | ||
107 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; | 107 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName }; |
108 | } | 108 | } |
109 | 109 | ||
110 | protected SceneObjectPart CreateSceneObjectPart2() | 110 | protected SceneObjectPart CreateSceneObjectPart2() |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index f86c790..aa306c7 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
225 | int tc = 0; | 225 | int tc = 0; |
226 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 226 | double[,] hm = whichScene.Heightmap.GetDoubles(); |
227 | tc = Environment.TickCount; | 227 | tc = Environment.TickCount; |
228 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); | 228 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); |
229 | EntityBase[] objs = whichScene.GetEntities(); | 229 | EntityBase[] objs = whichScene.GetEntities(); |
230 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | 230 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); |
231 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); | 231 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); |
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
541 | g.Dispose(); | 541 | g.Dispose(); |
542 | } // lock entities objs | 542 | } // lock entities objs |
543 | 543 | ||
544 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); | 544 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); |
545 | return mapbmp; | 545 | return mapbmp; |
546 | } | 546 | } |
547 | 547 | ||
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs index eb1a27f..992bff3 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
54 | public void TerrainToBitmap(Bitmap mapbmp) | 54 | public void TerrainToBitmap(Bitmap mapbmp) |
55 | { | 55 | { |
56 | int tc = Environment.TickCount; | 56 | int tc = Environment.TickCount; |
57 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 57 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); |
58 | 58 | ||
59 | double[,] hm = m_scene.Heightmap.GetDoubles(); | 59 | double[,] hm = m_scene.Heightmap.GetDoubles(); |
60 | bool ShadowDebugContinue = true; | 60 | bool ShadowDebugContinue = true; |
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 241 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | } | 244 | } |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index 1d2141e..d13c2ef 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
278 | public void TerrainToBitmap(Bitmap mapbmp) | 278 | public void TerrainToBitmap(Bitmap mapbmp) |
279 | { | 279 | { |
280 | int tc = Environment.TickCount; | 280 | int tc = Environment.TickCount; |
281 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 281 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); |
282 | 282 | ||
283 | // These textures should be in the AssetCache anyway, as every client conneting to this | 283 | // These textures should be in the AssetCache anyway, as every client conneting to this |
284 | // region needs them. Except on start, when the map is recreated (before anyone connected), | 284 | // region needs them. Except on start, when the map is recreated (before anyone connected), |
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
415 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 415 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } | 418 | } |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index f5a5c92..06fea58 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
282 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); | 282 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); |
283 | sb.AppendFormat("Parent: {0}", | 283 | sb.AppendFormat("Parent: {0}", |
284 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | 284 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); |
285 | sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; | 285 | sb.AppendFormat("Link number: {0}\n", sop.LinkNum); |
286 | 286 | ||
287 | return sb; | 287 | return sb; |
288 | } | 288 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index da81dc1..d78ade5 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -59,28 +59,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <returns>A terrain channel generated from the image.</returns> | 59 | /// <returns>A terrain channel generated from the image.</returns> |
60 | public virtual ITerrainChannel LoadFile(string filename) | 60 | public virtual ITerrainChannel LoadFile(string filename) |
61 | { | 61 | { |
62 | return LoadBitmap(new Bitmap(filename)); | 62 | using (Bitmap b = new Bitmap(filename)) |
63 | return LoadBitmap(b); | ||
63 | } | 64 | } |
64 | 65 | ||
65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) | 66 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 67 | { |
67 | Bitmap bitmap = new Bitmap(filename); | 68 | using (Bitmap bitmap = new Bitmap(filename)) |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | 69 | { |
72 | for (int y = 0; y < retval.Height; y++) | 70 | ITerrainChannel retval = new TerrainChannel(true); |
71 | |||
72 | for (int x = 0; x < retval.Width; x++) | ||
73 | { | 73 | { |
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | 74 | for (int y = 0; y < retval.Height; y++) |
75 | { | ||
76 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
77 | } | ||
75 | } | 78 | } |
76 | } | ||
77 | 79 | ||
78 | return retval; | 80 | return retval; |
81 | } | ||
79 | } | 82 | } |
80 | 83 | ||
81 | public virtual ITerrainChannel LoadStream(Stream stream) | 84 | public virtual ITerrainChannel LoadStream(Stream stream) |
82 | { | 85 | { |
83 | return LoadBitmap(new Bitmap(stream)); | 86 | using (Bitmap b = new Bitmap(stream)) |
87 | return LoadBitmap(b); | ||
84 | } | 88 | } |
85 | 89 | ||
86 | protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap) | 90 | protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap) |
@@ -134,35 +138,53 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." | 138 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." |
135 | string tempName = Path.GetTempFileName(); | 139 | string tempName = Path.GetTempFileName(); |
136 | 140 | ||
137 | Bitmap entireBitmap = null; | 141 | Bitmap existingBitmap = null; |
138 | Bitmap thisBitmap = null; | 142 | Bitmap thisBitmap = null; |
139 | if (File.Exists(filename)) | 143 | Bitmap newBitmap = null; |
144 | |||
145 | try | ||
140 | { | 146 | { |
141 | File.Copy(filename, tempName, true); | 147 | if (File.Exists(filename)) |
142 | entireBitmap = new Bitmap(tempName); | 148 | { |
143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) | 149 | File.Copy(filename, tempName, true); |
150 | existingBitmap = new Bitmap(tempName); | ||
151 | if (existingBitmap.Width != fileWidth * regionSizeX || existingBitmap.Height != fileHeight * regionSizeY) | ||
152 | { | ||
153 | // old file, let's overwrite it | ||
154 | newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | newBitmap = existingBitmap; | ||
159 | } | ||
160 | } | ||
161 | else | ||
144 | { | 162 | { |
145 | // old file, let's overwrite it | 163 | newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); |
146 | entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | ||
147 | } | 164 | } |
165 | |||
166 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | ||
167 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | ||
168 | for (int x = 0; x < regionSizeX; x++) | ||
169 | for (int y = 0; y < regionSizeY; y++) | ||
170 | newBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | ||
171 | |||
172 | Save(newBitmap, filename); | ||
148 | } | 173 | } |
149 | else | 174 | finally |
150 | { | 175 | { |
151 | entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | 176 | if (existingBitmap != null) |
152 | } | 177 | existingBitmap.Dispose(); |
153 | 178 | ||
154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | 179 | if (thisBitmap != null) |
155 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | 180 | thisBitmap.Dispose(); |
156 | for (int x = 0; x < regionSizeX; x++) | ||
157 | for (int y = 0; y < regionSizeY; y++) | ||
158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | ||
159 | 181 | ||
160 | Save(entireBitmap, filename); | 182 | if (newBitmap != null) |
161 | thisBitmap.Dispose(); | 183 | newBitmap.Dispose(); |
162 | entireBitmap.Dispose(); | ||
163 | 184 | ||
164 | if (File.Exists(tempName)) | 185 | if (File.Exists(tempName)) |
165 | File.Delete(tempName); | 186 | File.Delete(tempName); |
187 | } | ||
166 | } | 188 | } |
167 | 189 | ||
168 | protected virtual void Save(Bitmap bmp, string filename) | 190 | protected virtual void Save(Bitmap bmp, string filename) |
@@ -226,16 +248,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
226 | /// <returns>A System.Drawing.Bitmap containing a coloured image</returns> | 248 | /// <returns>A System.Drawing.Bitmap containing a coloured image</returns> |
227 | protected static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 249 | protected static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
228 | { | 250 | { |
229 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 251 | int pallete; |
230 | 252 | Bitmap bmp; | |
231 | int pallete = gradientmapLd.Height; | 253 | Color[] colours; |
232 | 254 | ||
233 | Bitmap bmp = new Bitmap(map.Width, map.Height); | 255 | using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png")) |
234 | Color[] colours = new Color[pallete]; | ||
235 | |||
236 | for (int i = 0; i < pallete; i++) | ||
237 | { | 256 | { |
238 | colours[i] = gradientmapLd.GetPixel(0, i); | 257 | pallete = gradientmapLd.Height; |
258 | |||
259 | bmp = new Bitmap(map.Width, map.Height); | ||
260 | colours = new Color[pallete]; | ||
261 | |||
262 | for (int i = 0; i < pallete; i++) | ||
263 | { | ||
264 | colours[i] = gradientmapLd.GetPixel(0, i); | ||
265 | } | ||
239 | } | 266 | } |
240 | 267 | ||
241 | for (int y = 0; y < map.Height; y++) | 268 | for (int y = 0; y < map.Height; y++) |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 699d67a..9cc767a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -99,16 +99,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
99 | 99 | ||
100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
101 | { | 101 | { |
102 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 102 | int pallete; |
103 | Bitmap bmp; | ||
104 | Color[] colours; | ||
103 | 105 | ||
104 | int pallete = gradientmapLd.Height; | 106 | using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png")) |
105 | |||
106 | Bitmap bmp = new Bitmap(map.Width, map.Height); | ||
107 | Color[] colours = new Color[pallete]; | ||
108 | |||
109 | for (int i = 0; i < pallete; i++) | ||
110 | { | 107 | { |
111 | colours[i] = gradientmapLd.GetPixel(0, i); | 108 | pallete = gradientmapLd.Height; |
109 | |||
110 | bmp = new Bitmap(map.Width, map.Height); | ||
111 | colours = new Color[pallete]; | ||
112 | |||
113 | for (int i = 0; i < pallete; i++) | ||
114 | { | ||
115 | colours[i] = gradientmapLd.GetPixel(0, i); | ||
116 | } | ||
112 | } | 117 | } |
113 | 118 | ||
114 | for (int y = 0; y < map.Height; y++) | 119 | for (int y = 0; y < map.Height; y++) |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs index 6163fd1..4f4e296 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs | |||
@@ -88,11 +88,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
88 | if (renderers.Count > 0) | 88 | if (renderers.Count > 0) |
89 | { | 89 | { |
90 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | 90 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); |
91 | m_log.Info("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString()); | 91 | m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString()); |
92 | } | 92 | } |
93 | else | 93 | else |
94 | { | 94 | { |
95 | m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); | 95 | m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); |
96 | } | 96 | } |
97 | 97 | ||
98 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 98 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |