aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs78
1 files changed, 39 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index d5c81ce..f4a8a6b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
61 /// A value of 0 will apply no pause. The pause is specified in milliseconds. 61 /// A value of 0 will apply no pause. The pause is specified in milliseconds.
62 /// </remarks> 62 /// </remarks>
63 public int ThrottlePer100PrimsRezzed { get; set; } 63 public int ThrottlePer100PrimsRezzed { get; set; }
64 64
65 private Scene m_scene; 65 private Scene m_scene;
66 private IInventoryAccessModule m_invAccessModule; 66 private IInventoryAccessModule m_invAccessModule;
67 67
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
69 /// Are attachments enabled? 69 /// Are attachments enabled?
70 /// </summary> 70 /// </summary>
71 public bool Enabled { get; private set; } 71 public bool Enabled { get; private set; }
72 72
73 public string Name { get { return "Attachments Module"; } } 73 public string Name { get { return "Attachments Module"; } }
74 public Type ReplaceableInterface { get { return null; } } 74 public Type ReplaceableInterface { get { return null; } }
75 75
@@ -87,14 +87,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
87 Enabled = true; 87 Enabled = true;
88 } 88 }
89 } 89 }
90 90
91 public void AddRegion(Scene scene) 91 public void AddRegion(Scene scene)
92 { 92 {
93 m_scene = scene; 93 m_scene = scene;
94 if (Enabled) 94 if (Enabled)
95 { 95 {
96 // Only register module with scene if it is enabled. All callers check for a null attachments module. 96 // Only register module with scene if it is enabled. All callers check for a null attachments module.
97 // Ideally, there should be a null attachments module for when this core attachments module has been 97 // Ideally, there should be a null attachments module for when this core attachments module has been
98 // disabled. Registering only when enabled allows for other attachments module implementations. 98 // disabled. Registering only when enabled allows for other attachments module implementations.
99 m_scene.RegisterModuleInterface<IAttachmentsModule>(this); 99 m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
100 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 100 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
@@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
181 private void HandleScriptStateChange(uint localID, bool started) 181 private void HandleScriptStateChange(uint localID, bool started)
182 { 182 {
183 SceneObjectGroup sog = m_scene.GetGroupByPrim(localID); 183 SceneObjectGroup sog = m_scene.GetGroupByPrim(localID);
184 if (sog != null && sog.IsAttachment) 184 if (sog != null && sog.IsAttachment)
185 { 185 {
186 if (!started) 186 if (!started)
187 { 187 {
@@ -198,21 +198,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
198 } 198 }
199 } 199 }
200 } 200 }
201 201
202 public void RemoveRegion(Scene scene) 202 public void RemoveRegion(Scene scene)
203 { 203 {
204 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); 204 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
205 205
206 if (Enabled) 206 if (Enabled)
207 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; 207 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
208 } 208 }
209 209
210 public void RegionLoaded(Scene scene) 210 public void RegionLoaded(Scene scene)
211 { 211 {
212 m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 212 m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>();
213 } 213 }
214 214
215 public void Close() 215 public void Close()
216 { 216 {
217 RemoveRegion(m_scene); 217 RemoveRegion(m_scene);
218 } 218 }
@@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
270 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); 270 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
271 271
272// m_log.DebugFormat( 272// m_log.DebugFormat(
273// "[ATTACHMENTS MODULE]: Copying script state with {0} bytes for object {1} for {2} in {3}", 273// "[ATTACHMENTS MODULE]: Copying script state with {0} bytes for object {1} for {2} in {3}",
274// ad.AttachmentObjectStates[i].Length, so.Name, sp.Name, m_scene.Name); 274// ad.AttachmentObjectStates[i].Length, so.Name, sp.Name, m_scene.Name);
275 275
276 so.SetState(ad.AttachmentObjectStates[i++], m_scene); 276 so.SetState(ad.AttachmentObjectStates[i++], m_scene);
@@ -295,7 +295,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
295 { 295 {
296 if (DebugLevel > 0) 296 if (DebugLevel > 0)
297 m_log.DebugFormat( 297 m_log.DebugFormat(
298 "[ATTACHMENTS MODULE]: Not doing simulator-side attachment rez for {0} in {1} as their viewer has already rezzed attachments", 298 "[ATTACHMENTS MODULE]: Not doing simulator-side attachment rez for {0} in {1} as their viewer has already rezzed attachments",
299 m_scene.Name, sp.Name); 299 m_scene.Name, sp.Name);
300 300
301 return; 301 return;
@@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
357 357
358 // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down 358 // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
359 // But they're not used anyway, the item is being looked up for now, so let's proceed. 359 // But they're not used anyway, the item is being looked up for now, so let's proceed.
360 //if (UUID.Zero == assetID) 360 //if (UUID.Zero == assetID)
361 //{ 361 //{
362 // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); 362 // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID);
363 // continue; 363 // continue;
@@ -434,7 +434,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
434 UpdateDetachedObject(sp, so, String.Empty); 434 UpdateDetachedObject(sp, so, String.Empty);
435 sp.ClearAttachments(); 435 sp.ClearAttachments();
436 } 436 }
437 } 437 }
438 } 438 }
439 439
440 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) 440 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
@@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
445 if (DebugLevel > 0) 445 if (DebugLevel > 0)
446 m_log.DebugFormat( 446 m_log.DebugFormat(
447 "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", 447 "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
448 m_scene.RegionInfo.RegionName, sp.Name, silent); 448 m_scene.RegionInfo.RegionName, sp.Name, silent);
449 449
450 foreach (SceneObjectGroup sop in sp.GetAttachments()) 450 foreach (SceneObjectGroup sop in sp.GetAttachments())
451 { 451 {
@@ -454,7 +454,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
454 454
455 sp.ClearAttachments(); 455 sp.ClearAttachments();
456 } 456 }
457 457
458 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, 458 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent,
459 bool addToInventory, bool append) 459 bool addToInventory, bool append)
460 { 460 {
@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
505 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 505 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
506 // be removed when that functionality is implemented in opensim 506 // be removed when that functionality is implemented in opensim
507 attachmentPt &= 0x7f; 507 attachmentPt &= 0x7f;
508 508
509 // If the attachment point isn't the same as the one previously used 509 // If the attachment point isn't the same as the one previously used
510 // set it's offset position = 0 so that it appears on the attachment point 510 // set it's offset position = 0 so that it appears on the attachment point
511 // and not in a weird location somewhere unknown. 511 // and not in a weird location somewhere unknown.
@@ -583,7 +583,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
583 583
584 if (addToInventory && sp.PresenceType != PresenceType.Npc) 584 if (addToInventory && sp.PresenceType != PresenceType.Npc)
585 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); 585 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
586 586
587 AttachToAgent(sp, group, attachmentPt, attachPos, silent); 587 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
588 588
589 if (resumeScripts) 589 if (resumeScripts)
@@ -616,11 +616,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
616 } 616 }
617 617
618 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) 618 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
619 { 619 {
620 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null); 620 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null);
621 } 621 }
622 622
623 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc) 623 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc)
624 { 624 {
625 if (!Enabled) 625 if (!Enabled)
626 return null; 626 return null;
@@ -631,8 +631,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
631 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); 631 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);
632 632
633 // We check the attachments in the avatar appearance here rather than the objects attached to the 633 // We check the attachments in the avatar appearance here rather than the objects attached to the
634 // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are 634 // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are
635 // already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done 635 // already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done
636 // because pre-outfit folder viewers (most version 1 viewers) require it. 636 // because pre-outfit folder viewers (most version 1 viewers) require it.
637 bool alreadyOn = false; 637 bool alreadyOn = false;
638 List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments(); 638 List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
@@ -668,7 +668,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
668 668
669 if (DebugLevel > 0) 669 if (DebugLevel > 0)
670 m_log.DebugFormat( 670 m_log.DebugFormat(
671 "[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}", 671 "[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}",
672 rezlist.Count, sp.Name, m_scene.Name); 672 rezlist.Count, sp.Name, m_scene.Name);
673 673
674 foreach (KeyValuePair<UUID, uint> rez in rezlist) 674 foreach (KeyValuePair<UUID, uint> rez in rezlist)
@@ -727,7 +727,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
727 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); 727 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
728 728
729 so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; 729 so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint;
730 730
731 sp.RemoveAttachment(so); 731 sp.RemoveAttachment(so);
732 so.FromItemID = UUID.Zero; 732 so.FromItemID = UUID.Zero;
733 733
@@ -744,7 +744,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
744 } 744 }
745 745
746 rootPart.RemFlag(PrimFlags.TemporaryOnRez); 746 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
747 747
748 so.ApplyPhysics(); 748 so.ApplyPhysics();
749 749
750 rootPart.Rezzed = DateTime.Now; 750 rootPart.Rezzed = DateTime.Now;
@@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
804 804
805 if (DebugLevel > 0) 805 if (DebugLevel > 0)
806 m_log.DebugFormat( 806 m_log.DebugFormat(
807 "[ATTACHMENTS MODULE]: Detaching object {0} {1} (FromItemID {2}) for {3} in {4}", 807 "[ATTACHMENTS MODULE]: Detaching object {0} {1} (FromItemID {2}) for {3} in {4}",
808 so.Name, so.LocalId, so.FromItemID, sp.Name, m_scene.Name); 808 so.Name, so.LocalId, so.FromItemID, sp.Name, m_scene.Name);
809 809
810 // Scripts MUST be snapshotted before the object is 810 // Scripts MUST be snapshotted before the object is
@@ -827,14 +827,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
827 UpdateDetachedObject(sp, so, scriptedState); 827 UpdateDetachedObject(sp, so, scriptedState);
828 } 828 }
829 } 829 }
830 830
831 public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) 831 public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos)
832 { 832 {
833 if (!Enabled) 833 if (!Enabled)
834 return; 834 return;
835 835
836 sog.UpdateGroupPosition(pos); 836 sog.UpdateGroupPosition(pos);
837 sog.HasGroupChanged = true; 837 sog.HasGroupChanged = true;
838 } 838 }
839 839
840 #endregion 840 #endregion
@@ -843,7 +843,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
843 843
844 // This is public but is not part of the IAttachmentsModule interface. 844 // This is public but is not part of the IAttachmentsModule interface.
845 // RegionCombiner module needs to poke at it to deliver client events. 845 // RegionCombiner module needs to poke at it to deliver client events.
846 // This breaks the encapsulation of the module and should get fixed somehow. 846 // This breaks the encapsulation of the module and should get fixed somehow.
847 public void SubscribeToClientEvents(IClientAPI client) 847 public void SubscribeToClientEvents(IClientAPI client)
848 { 848 {
849 client.OnRezSingleAttachmentFromInv += Client_OnRezSingleAttachmentFromInv; 849 client.OnRezSingleAttachmentFromInv += Client_OnRezSingleAttachmentFromInv;
@@ -856,7 +856,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
856 856
857 // This is public but is not part of the IAttachmentsModule interface. 857 // This is public but is not part of the IAttachmentsModule interface.
858 // RegionCombiner module needs to poke at it to deliver client events. 858 // RegionCombiner module needs to poke at it to deliver client events.
859 // This breaks the encapsulation of the module and should get fixed somehow. 859 // This breaks the encapsulation of the module and should get fixed somehow.
860 public void UnsubscribeFromClientEvents(IClientAPI client) 860 public void UnsubscribeFromClientEvents(IClientAPI client)
861 { 861 {
862 client.OnRezSingleAttachmentFromInv -= Client_OnRezSingleAttachmentFromInv; 862 client.OnRezSingleAttachmentFromInv -= Client_OnRezSingleAttachmentFromInv;
@@ -936,7 +936,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
936 /// Attach this scene object to the given avatar. 936 /// Attach this scene object to the given avatar.
937 /// </summary> 937 /// </summary>
938 /// <remarks> 938 /// <remarks>
939 /// This isn't publicly available since attachments should always perform the corresponding inventory 939 /// This isn't publicly available since attachments should always perform the corresponding inventory
940 /// operation (to show the attach in user inventory and update the asset with positional information). 940 /// operation (to show the attach in user inventory and update the asset with positional information).
941 /// </remarks> 941 /// </remarks>
942 /// <param name="sp"></param> 942 /// <param name="sp"></param>
@@ -997,7 +997,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
997 997
998 // Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update 998 // Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update
999 // will succeed, as that will not update if an attachment is selected. 999 // will succeed, as that will not update if an attachment is selected.
1000 so.IsSelected = false; // fudge.... 1000 so.IsSelected = false; // fudge....
1001 1001
1002 so.ScheduleGroupForFullUpdate(); 1002 so.ScheduleGroupForFullUpdate();
1003 } 1003 }
@@ -1041,7 +1041,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1041 /// </summary> 1041 /// </summary>
1042 /// <remarks> 1042 /// <remarks>
1043 /// This involves triggering the detach event and getting the script state (which also stops the script) 1043 /// This involves triggering the detach event and getting the script state (which also stops the script)
1044 /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a 1044 /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a
1045 /// running script is performing attachment operations. 1045 /// running script is performing attachment operations.
1046 /// </remarks> 1046 /// </remarks>
1047 /// <returns> 1047 /// <returns>
@@ -1088,7 +1088,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1088 // Remove the object from the scene so no more updates 1088 // Remove the object from the scene so no more updates
1089 // are sent. Doing this before the below changes will ensure 1089 // are sent. Doing this before the below changes will ensure
1090 // updates can't cause "HUD artefacts" 1090 // updates can't cause "HUD artefacts"
1091 1091
1092 m_scene.DeleteSceneObject(so, false, false); 1092 m_scene.DeleteSceneObject(so, false, false);
1093 1093
1094 // Prepare sog for storage 1094 // Prepare sog for storage
@@ -1125,7 +1125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1125 itemID, rezGroupID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 1125 itemID, rezGroupID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
1126 false, false, sp.UUID, true); 1126 false, false, sp.UUID, true);
1127 else 1127 else
1128 objatt = m_invAccessModule.RezObject(sp.ControllingClient, 1128 objatt = m_invAccessModule.RezObject(sp.ControllingClient,
1129 null, rezGroupID, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 1129 null, rezGroupID, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
1130 false, false, sp.UUID, true); 1130 false, false, sp.UUID, true);
1131 1131
@@ -1139,7 +1139,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1139 } 1139 }
1140 else if (itemID == UUID.Zero) 1140 else if (itemID == UUID.Zero)
1141 { 1141 {
1142 // We need to have a FromItemID for multiple attachments on a single attach point to appear. This is 1142 // We need to have a FromItemID for multiple attachments on a single attach point to appear. This is
1143 // true on Singularity 1.8.5 and quite possibly other viewers as well. As NPCs don't have an inventory 1143 // true on Singularity 1.8.5 and quite possibly other viewers as well. As NPCs don't have an inventory
1144 // we will satisfy this requirement by inserting a random UUID. 1144 // we will satisfy this requirement by inserting a random UUID.
1145 objatt.FromItemID = UUID.Random(); 1145 objatt.FromItemID = UUID.Random();
@@ -1185,7 +1185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1185 } 1185 }
1186 1186
1187 if (tainted) 1187 if (tainted)
1188 objatt.HasGroupChanged = true; 1188 objatt.HasGroupChanged = true;
1189 1189
1190 if (ThrottlePer100PrimsRezzed > 0) 1190 if (ThrottlePer100PrimsRezzed > 0)
1191 { 1191 {