diff options
author | Melanie | 2011-10-11 23:14:23 +0100 |
---|---|---|
committer | Melanie | 2011-10-11 23:14:23 +0100 |
commit | d1e681f68253e8a3a8f45132bb5a2d581a510fa0 (patch) | |
tree | ac0efa90456b8b566872e9b54a22c9a882e60ab0 /OpenSim/Region | |
parent | Merge commit '528fcede6c31c056c3863fd19528558fcbaf475f' into bigmerge (diff) | |
parent | Add Enabled switch in new [Attachments] section in OpenSimDefaults.ini to all... (diff) | |
download | opensim-SC-d1e681f68253e8a3a8f45132bb5a2d581a510fa0.zip opensim-SC-d1e681f68253e8a3a8f45132bb5a2d581a510fa0.tar.gz opensim-SC-d1e681f68253e8a3a8f45132bb5a2d581a510fa0.tar.bz2 opensim-SC-d1e681f68253e8a3a8f45132bb5a2d581a510fa0.tar.xz |
Merge commit 'e742cffe15d3e50841908d7babc2e4c4a7630635' into bigmerge
Conflicts:
OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 1 |
2 files changed, 54 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a130ed2..3bdb173 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -49,25 +49,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
49 | 49 | ||
50 | private Scene m_scene; | 50 | private Scene m_scene; |
51 | private IDialogModule m_dialogModule; | 51 | private IDialogModule m_dialogModule; |
52 | |||
53 | /// <summary> | ||
54 | /// Are attachments enabled? | ||
55 | /// </summary> | ||
56 | public bool Enabled { get; private set; } | ||
52 | 57 | ||
53 | public string Name { get { return "Attachments Module"; } } | 58 | public string Name { get { return "Attachments Module"; } } |
54 | public Type ReplaceableInterface { get { return null; } } | 59 | public Type ReplaceableInterface { get { return null; } } |
55 | 60 | ||
56 | public void Initialise(IConfigSource source) {} | 61 | public void Initialise(IConfigSource source) |
62 | { | ||
63 | IConfig config = source.Configs["Attachments"]; | ||
64 | if (config != null) | ||
65 | Enabled = config.GetBoolean("Enabled", true); | ||
66 | else | ||
67 | Enabled = true; | ||
68 | } | ||
57 | 69 | ||
58 | public void AddRegion(Scene scene) | 70 | public void AddRegion(Scene scene) |
59 | { | 71 | { |
60 | m_scene = scene; | 72 | m_scene = scene; |
61 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | 73 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); |
62 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 74 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
63 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 75 | |
76 | if (Enabled) | ||
77 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
78 | |||
64 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | 79 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI |
65 | } | 80 | } |
66 | 81 | ||
67 | public void RemoveRegion(Scene scene) | 82 | public void RemoveRegion(Scene scene) |
68 | { | 83 | { |
69 | m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); | 84 | m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); |
70 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 85 | |
86 | if (Enabled) | ||
87 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
71 | } | 88 | } |
72 | 89 | ||
73 | public void RegionLoaded(Scene scene) {} | 90 | public void RegionLoaded(Scene scene) {} |
@@ -103,6 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
103 | /// </summary> | 120 | /// </summary> |
104 | public void RezAttachments(IScenePresence sp) | 121 | public void RezAttachments(IScenePresence sp) |
105 | { | 122 | { |
123 | if (!Enabled) | ||
124 | return; | ||
125 | |||
106 | if (null == sp.Appearance) | 126 | if (null == sp.Appearance) |
107 | { | 127 | { |
108 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); | 128 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); |
@@ -146,6 +166,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
146 | { | 166 | { |
147 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | 167 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); |
148 | 168 | ||
169 | if (!Enabled) | ||
170 | return; | ||
171 | |||
149 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 172 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
150 | { | 173 | { |
151 | // if (grp.HasGroupChanged) // Resizer scripts? | 174 | // if (grp.HasGroupChanged) // Resizer scripts? |
@@ -164,6 +187,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
164 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | 187 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", |
165 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | 188 | // m_scene.RegionInfo.RegionName, sp.Name, silent); |
166 | 189 | ||
190 | if (!Enabled) | ||
191 | return; | ||
192 | |||
167 | foreach (SceneObjectGroup sop in sp.GetAttachments()) | 193 | foreach (SceneObjectGroup sop in sp.GetAttachments()) |
168 | { | 194 | { |
169 | sop.Scene.DeleteSceneObject(sop, silent); | 195 | sop.Scene.DeleteSceneObject(sop, silent); |
@@ -185,6 +211,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
185 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", | 211 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", |
186 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); | 212 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); |
187 | 213 | ||
214 | if (!Enabled) | ||
215 | return; | ||
216 | |||
188 | try | 217 | try |
189 | { | 218 | { |
190 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 219 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
@@ -240,6 +269,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
240 | 269 | ||
241 | public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) | 270 | public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) |
242 | { | 271 | { |
272 | if (!Enabled) | ||
273 | return false; | ||
274 | |||
243 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 275 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
244 | 276 | ||
245 | if (sp == null) | 277 | if (sp == null) |
@@ -339,6 +371,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
339 | RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, | 371 | RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, |
340 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) | 372 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) |
341 | { | 373 | { |
374 | if (!Enabled) | ||
375 | return; | ||
376 | |||
342 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 377 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
343 | 378 | ||
344 | if (sp == null) | 379 | if (sp == null) |
@@ -368,6 +403,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
368 | public ISceneEntity RezSingleAttachmentFromInventory( | 403 | public ISceneEntity RezSingleAttachmentFromInventory( |
369 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | 404 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) |
370 | { | 405 | { |
406 | if (!Enabled) | ||
407 | return null; | ||
408 | |||
371 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 409 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
372 | 410 | ||
373 | if (sp == null) | 411 | if (sp == null) |
@@ -383,6 +421,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
383 | 421 | ||
384 | public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) | 422 | public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) |
385 | { | 423 | { |
424 | if (!Enabled) | ||
425 | return null; | ||
426 | |||
386 | // m_log.DebugFormat( | 427 | // m_log.DebugFormat( |
387 | // "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}", | 428 | // "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}", |
388 | // (AttachmentPoint)AttachmentPt, itemID, sp.Name); | 429 | // (AttachmentPoint)AttachmentPt, itemID, sp.Name); |
@@ -570,6 +611,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
570 | 611 | ||
571 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | 612 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) |
572 | { | 613 | { |
614 | if (!Enabled) | ||
615 | return; | ||
616 | |||
573 | ScenePresence presence; | 617 | ScenePresence presence; |
574 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 618 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
575 | { | 619 | { |
@@ -589,6 +633,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
589 | 633 | ||
590 | public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) | 634 | public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) |
591 | { | 635 | { |
636 | if (!Enabled) | ||
637 | return; | ||
638 | |||
592 | // m_log.DebugFormat( | 639 | // m_log.DebugFormat( |
593 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", | 640 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", |
594 | // remoteClient.Name, soLocalId); | 641 | // remoteClient.Name, soLocalId); |
@@ -704,6 +751,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
704 | 751 | ||
705 | public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) | 752 | public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) |
706 | { | 753 | { |
754 | if (!Enabled) | ||
755 | return; | ||
756 | |||
707 | // First we save the | 757 | // First we save the |
708 | // attachment point information, then we update the relative | 758 | // attachment point information, then we update the relative |
709 | // positioning. Then we have to mark the object as NOT an | 759 | // positioning. Then we have to mark the object as NOT an |
@@ -917,4 +967,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
917 | return item; | 967 | return item; |
918 | } | 968 | } |
919 | } | 969 | } |
920 | } \ No newline at end of file | 970 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index f05b090..dd6bdf7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
150 | { | 150 | { |
151 | if (!m_Enabled) | 151 | if (!m_Enabled) |
152 | return; | 152 | return; |
153 | |||
154 | } | 153 | } |
155 | 154 | ||
156 | #endregion | 155 | #endregion |