aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
5 files changed, 40 insertions, 92 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 21c1056..0222b02 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -56,7 +56,30 @@ namespace OpenSim.Region.Framework.Interfaces
56 /// <param name="silent"></param> 56 /// <param name="silent"></param>
57 /// <returns>true if the object was successfully attached, false otherwise</returns> 57 /// <returns>true if the object was successfully attached, false otherwise</returns>
58 bool AttachObject( 58 bool AttachObject(
59 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); 59 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
60
61 /// <summary>
62 /// Rez an attachment from user inventory and change inventory status to match.
63 /// </summary>
64 /// <param name="remoteClient"></param>
65 /// <param name="itemID"></param>
66 /// <param name="AttachmentPt"></param>
67 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
68 UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
69
70 /// <summary>
71 /// Rez an attachment from user inventory
72 /// </summary>
73 /// <param name="remoteClient"></param>
74 /// <param name="itemID"></param>
75 /// <param name="AttachmentPt"></param>
76 /// <param name="updateinventoryStatus">
77 /// If true, we also update the user's inventory to show that the attachment is set. If false, we do not.
78 /// False is required so that we don't attempt to update information when a user enters a scene with the
79 /// attachment already correctly set up in inventory.
80 /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
81 UUID RezSingleAttachmentFromInventory(
82 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
60 83
61 /// <summary> 84 /// <summary>
62 /// Update the user inventory to the attachment of an item 85 /// Update the user inventory to the attachment of an item
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7277527..41533a1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1842,35 +1842,12 @@ namespace OpenSim.Region.Framework.Scenes
1842 EventManager.TriggerOnAttach(localID, itemID, avatarID); 1842 EventManager.TriggerOnAttach(localID, itemID, avatarID);
1843 } 1843 }
1844 1844
1845 /// <summary>
1846 /// Called when the client receives a request to rez a single attachment on to the avatar from inventory
1847 /// (RezSingleAttachmentFromInv packet).
1848 /// </summary>
1849 /// <param name="remoteClient"></param>
1850 /// <param name="itemID"></param>
1851 /// <param name="AttachmentPt"></param>
1852 /// <returns></returns>
1853 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
1854 {
1855 m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
1856
1857 SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
1858
1859 if (att == null)
1860 {
1861 AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
1862 return UUID.Zero;
1863 }
1864
1865 return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
1866 }
1867
1868 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 1845 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
1869 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) 1846 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
1870 { 1847 {
1871 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) 1848 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
1872 { 1849 {
1873 RezSingleAttachment(remoteClient, obj.ItemID, obj.AttachmentPt); 1850 AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
1874 } 1851 }
1875 } 1852 }
1876 1853
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d4d134f..c510dc8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Framework.Scenes
2338 //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); 2338 //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
2339 2339
2340 ScenePresence sp = GetScenePresence(userID); 2340 ScenePresence sp = GetScenePresence(userID);
2341 if (sp != null) 2341 if (sp != null && AttachmentsModule != null)
2342 { 2342 {
2343 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); 2343 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
2344 m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt); 2344 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
2345 } 2345 }
2346 2346
2347 return false; 2347 return false;
@@ -2642,13 +2642,13 @@ namespace OpenSim.Region.Framework.Scenes
2642 } 2642 }
2643 2643
2644 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) 2644 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2645 { 2645 {
2646 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2647 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; 2646 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
2648 client.OnObjectDetach += m_sceneGraph.DetachObject; 2647 client.OnObjectDetach += m_sceneGraph.DetachObject;
2649 2648
2650 if (AttachmentsModule != null) 2649 if (AttachmentsModule != null)
2651 { 2650 {
2651 client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
2652 client.OnObjectAttach += AttachmentsModule.AttachObject; 2652 client.OnObjectAttach += AttachmentsModule.AttachObject;
2653 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; 2653 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2654 } 2654 }
@@ -2799,12 +2799,12 @@ namespace OpenSim.Region.Framework.Scenes
2799 2799
2800 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) 2800 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
2801 { 2801 {
2802 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; 2802 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
2803 client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
2804 client.OnObjectDetach -= m_sceneGraph.DetachObject; 2803 client.OnObjectDetach -= m_sceneGraph.DetachObject;
2805 2804
2806 if (AttachmentsModule != null) 2805 if (AttachmentsModule != null)
2807 { 2806 {
2807 client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
2808 client.OnObjectAttach -= AttachmentsModule.AttachObject; 2808 client.OnObjectAttach -= AttachmentsModule.AttachObject;
2809 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; 2809 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
2810 } 2810 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a88d456..d944834 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -486,59 +486,6 @@ namespace OpenSim.Region.Framework.Scenes
486 } 486 }
487 } 487 }
488 488
489 /// <summary>
490 /// Rez an attachment
491 /// </summary>
492 /// <param name="remoteClient"></param>
493 /// <param name="itemID"></param>
494 /// <param name="AttachmentPt"></param>
495 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
496 public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
497 {
498 IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>();
499 if (invAccess != null)
500 {
501 SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
502 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
503 false, false, remoteClient.AgentId, true);
504
505// m_log.DebugFormat(
506// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
507// objatt.Name, remoteClient.Name, AttachmentPt);
508
509 if (objatt != null)
510 {
511 bool tainted = false;
512 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
513 tainted = true;
514
515 m_parentScene.AttachmentsModule.AttachObject(
516 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
517 //objatt.ScheduleGroupForFullUpdate();
518
519 if (tainted)
520 objatt.HasGroupChanged = true;
521
522 // Fire after attach, so we don't get messy perms dialogs
523 // 3 == AttachedRez
524 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
525
526 // Do this last so that event listeners have access to all the effects of the attachment
527 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
528 }
529 else
530 {
531 m_log.WarnFormat(
532 "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
533 itemID, remoteClient.Name, AttachmentPt);
534 }
535
536 return objatt;
537 }
538
539 return null;
540 }
541
542 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 489 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
543 { 490 {
544 ScenePresence newAvatar = null; 491 ScenePresence newAvatar = null;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7661f1e..6f16ff3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -676,7 +676,8 @@ namespace OpenSim.Region.Framework.Scenes
676 676
677 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 677 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
678 678
679 m_userLevel = account.UserLevel; 679 if (account != null)
680 m_userLevel = account.UserLevel;
680 681
681 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 682 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
682 if (gm != null) 683 if (gm != null)
@@ -3738,7 +3739,7 @@ namespace OpenSim.Region.Framework.Scenes
3738 { 3739 {
3739 if (null == m_appearance) 3740 if (null == m_appearance)
3740 { 3741 {
3741 m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); 3742 m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID);
3742 return; 3743 return;
3743 } 3744 }
3744 3745
@@ -3762,12 +3763,12 @@ namespace OpenSim.Region.Framework.Scenes
3762 try 3763 try
3763 { 3764 {
3764 // Rez from inventory 3765 // Rez from inventory
3765 UUID asset = m_scene.RezSingleAttachment(ControllingClient, 3766 UUID asset
3766 itemID, (uint)p); 3767 = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p);
3767
3768 m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3769 p, itemID, assetID, asset);
3770 3768
3769 m_log.InfoFormat(
3770 "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3771 p, itemID, assetID, asset);
3771 } 3772 }
3772 catch (Exception e) 3773 catch (Exception e)
3773 { 3774 {