aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2010-03-15 17:23:35 +0000
committerMelanie2010-03-15 17:23:35 +0000
commitd3f33acc1a6a385ee19814286fe27cb5e48c1551 (patch)
tree07795e74a637ca63d96b5ee06950b8c1a7a99489 /OpenSim/Region/Framework
parentMerge branch 'careminster' into careminster-presence-refactor (diff)
parentflip UVs for profile faces (diff)
downloadopensim-SC_OLD-d3f33acc1a6a385ee19814286fe27cb5e48c1551.zip
opensim-SC_OLD-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.gz
opensim-SC_OLD-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.bz2
opensim-SC_OLD-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs42
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs88
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs13
10 files changed, 116 insertions, 166 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 367ff3d..0222b02 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -31,21 +31,55 @@ using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32 32
33namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
34{ 34{
35 public interface IAttachmentsModule 35 public interface IAttachmentsModule
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Attach an object to an avatar from the world.
39 /// </summary>
40 /// <param name="controllingClient"></param>
41 /// <param name="localID"></param>
42 /// <param name="attachPoint"></param>
43 /// <param name="rot"></param>
44 /// <param name="silent"></param>
45 void AttachObject(
46 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent);
47
48 /// <summary>
38 /// Attach an object to an avatar. 49 /// Attach an object to an avatar.
39 /// </summary> 50 /// </summary>
40 /// <param name="controllingClient"></param> 51 /// <param name="controllingClient"></param>
41 /// <param name="localID"></param> 52 /// <param name="localID"></param>
42 /// <param name="attachPoint"></param> 53 /// <param name="attachPoint"></param>
43 /// <param name="rot"></param> 54 /// <param name="rot"></param>
44 /// <param name="pos"></param> 55 /// <param name="attachPos"></param>
45 /// <param name="silent"></param> 56 /// <param name="silent"></param>
46 /// <returns>true if the object was successfully attached, false otherwise</returns> 57 /// <returns>true if the object was successfully attached, false otherwise</returns>
47 bool AttachObject( 58 bool AttachObject(
48 IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, 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);
49 83
50 /// <summary> 84 /// <summary>
51 /// Update the user inventory to the attachment of an item 85 /// Update the user inventory to the attachment of an item
@@ -54,7 +88,7 @@ namespace OpenSim.Region.Framework.Interfaces
54 /// <param name="remoteClient"></param> 88 /// <param name="remoteClient"></param>
55 /// <param name="itemID"></param> 89 /// <param name="itemID"></param>
56 /// <param name="AttachmentPt"></param> 90 /// <param name="AttachmentPt"></param>
57 /// <returns></returns> 91 /// <returns></returns>
58 UUID SetAttachmentInventoryStatus( 92 UUID SetAttachmentInventoryStatus(
59 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt); 93 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
60 94
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 2401402..8185258 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3 30
4using OpenSim.Framework; 31using OpenSim.Framework;
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 1650946..37a51d9 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -113,15 +113,15 @@ namespace OpenSim.Region.Framework.Scenes
113 /// Fired when an object is touched/grabbed. 113 /// Fired when an object is touched/grabbed.
114 /// </summary> 114 /// </summary>
115 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of 115 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
116 /// the root part. 116 /// the root part.
117 public event ObjectGrabDelegate OnObjectGrab; 117 public event ObjectGrabDelegate OnObjectGrab;
118 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); 118 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
119 119
120 public event ObjectGrabDelegate OnObjectGrabbing; 120 public event ObjectGrabDelegate OnObjectGrabbing;
121 public event ObjectDeGrabDelegate OnObjectDeGrab; 121 public event ObjectDeGrabDelegate OnObjectDeGrab;
122 public event ScriptResetDelegate OnScriptReset; 122 public event ScriptResetDelegate OnScriptReset;
123 123
124 public event OnPermissionErrorDelegate OnPermissionError; 124 public event OnPermissionErrorDelegate OnPermissionError;
125 125
126 /// <summary> 126 /// <summary>
127 /// Fired when a new script is created. 127 /// Fired when a new script is created.
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
169 169
170 public delegate void ClientClosed(UUID clientID, Scene scene); 170 public delegate void ClientClosed(UUID clientID, Scene scene);
171 171
172 public event ClientClosed OnClientClosed; 172 public event ClientClosed OnClientClosed;
173 173
174 /// <summary> 174 /// <summary>
175 /// This is fired when a scene object property that a script might be interested in (such as color, scale or 175 /// This is fired when a scene object property that a script might be interested in (such as color, scale or
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index eb51019..6ebd048 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1106,18 +1106,18 @@ namespace OpenSim.Region.Framework.Scenes
1106 if (folder == null) 1106 if (folder == null)
1107 return; 1107 return;
1108 1108
1109 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); 1109 // Fetch the folder contents
1110 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); 1110 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
1111 InventoryFolderBase containingFolder = new InventoryFolderBase(); 1111
1112 containingFolder.ID = folder.ID; 1112 // Fetch the folder itself to get its current version
1113 containingFolder.Owner = client.AgentId; 1113 InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId);
1114 containingFolder = InventoryService.GetFolder(containingFolder); 1114 containingFolder = InventoryService.GetFolder(containingFolder);
1115 if (containingFolder != null)
1116 {
1117 int version = containingFolder.Version;
1118 1115
1119 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); 1116 //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
1120 } 1117 // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
1118
1119 if (containingFolder != null)
1120 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems);
1121 } 1121 }
1122 1122
1123 /// <summary> 1123 /// <summary>
@@ -1846,35 +1846,12 @@ namespace OpenSim.Region.Framework.Scenes
1846 EventManager.TriggerOnAttach(localID, itemID, avatarID); 1846 EventManager.TriggerOnAttach(localID, itemID, avatarID);
1847 } 1847 }
1848 1848
1849 /// <summary>
1850 /// Called when the client receives a request to rez a single attachment on to the avatar from inventory
1851 /// (RezSingleAttachmentFromInv packet).
1852 /// </summary>
1853 /// <param name="remoteClient"></param>
1854 /// <param name="itemID"></param>
1855 /// <param name="AttachmentPt"></param>
1856 /// <returns></returns>
1857 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
1858 {
1859 m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
1860
1861 SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
1862
1863 if (att == null)
1864 {
1865 AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
1866 return UUID.Zero;
1867 }
1868
1869 return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
1870 }
1871
1872 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 1849 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
1873 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) 1850 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
1874 { 1851 {
1875 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) 1852 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
1876 { 1853 {
1877 RezSingleAttachment(remoteClient, obj.ItemID, obj.AttachmentPt); 1854 AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
1878 } 1855 }
1879 } 1856 }
1880 1857
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d5d1825..03f1ee2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2003,7 +2003,7 @@ namespace OpenSim.Region.Framework.Scenes
2003 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2003 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2004 { 2004 {
2005 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2005 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
2006 } 2006 }
2007 2007
2008 /// <summary> 2008 /// <summary>
2009 /// Delete every object from the scene 2009 /// Delete every object from the scene
@@ -2365,10 +2365,10 @@ namespace OpenSim.Region.Framework.Scenes
2365 //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); 2365 //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
2366 2366
2367 ScenePresence sp = GetScenePresence(userID); 2367 ScenePresence sp = GetScenePresence(userID);
2368 if (sp != null) 2368 if (sp != null && AttachmentsModule != null)
2369 { 2369 {
2370 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); 2370 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
2371 m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt); 2371 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
2372 } 2372 }
2373 2373
2374 return false; 2374 return false;
@@ -2669,14 +2669,16 @@ namespace OpenSim.Region.Framework.Scenes
2669 } 2669 }
2670 2670
2671 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) 2671 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2672 { 2672 {
2673 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2674 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; 2673 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
2675 client.OnObjectAttach += m_sceneGraph.AttachObject;
2676 client.OnObjectDetach += m_sceneGraph.DetachObject; 2674 client.OnObjectDetach += m_sceneGraph.DetachObject;
2677 2675
2678 if (AttachmentsModule != null) 2676 if (AttachmentsModule != null)
2677 {
2678 client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
2679 client.OnObjectAttach += AttachmentsModule.AttachObject;
2679 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; 2680 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2681 }
2680 } 2682 }
2681 2683
2682 public virtual void SubscribeToClientTeleportEvents(IClientAPI client) 2684 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
@@ -2723,7 +2725,7 @@ namespace OpenSim.Region.Framework.Scenes
2723 } 2725 }
2724 2726
2725 protected virtual void UnsubscribeToClientEvents(IClientAPI client) 2727 protected virtual void UnsubscribeToClientEvents(IClientAPI client)
2726 { 2728 {
2727 } 2729 }
2728 2730
2729 /// <summary> 2731 /// <summary>
@@ -2801,7 +2803,6 @@ namespace OpenSim.Region.Framework.Scenes
2801 client.OnRezObject -= RezObject; 2803 client.OnRezObject -= RezObject;
2802 } 2804 }
2803 2805
2804
2805 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) 2806 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client)
2806 { 2807 {
2807 client.OnCreateNewInventoryItem -= CreateNewInventoryItem; 2808 client.OnCreateNewInventoryItem -= CreateNewInventoryItem;
@@ -2824,14 +2825,16 @@ namespace OpenSim.Region.Framework.Scenes
2824 } 2825 }
2825 2826
2826 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) 2827 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
2827 { 2828 {
2828 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; 2829 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
2829 client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
2830 client.OnObjectAttach -= m_sceneGraph.AttachObject;
2831 client.OnObjectDetach -= m_sceneGraph.DetachObject; 2830 client.OnObjectDetach -= m_sceneGraph.DetachObject;
2832 2831
2833 if (AttachmentsModule != null) 2832 if (AttachmentsModule != null)
2833 {
2834 client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
2835 client.OnObjectAttach -= AttachmentsModule.AttachObject;
2834 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; 2836 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
2837 }
2835 } 2838 }
2836 2839
2837 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) 2840 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
@@ -3559,7 +3562,7 @@ namespace OpenSim.Region.Framework.Scenes
3559 { 3562 {
3560 foreach (var parcel in AllParcels()) 3563 foreach (var parcel in AllParcels())
3561 { 3564 {
3562 if( parcel.ContainsPoint((int)x,(int)y)) 3565 if (parcel.ContainsPoint((int)x,(int)y))
3563 { 3566 {
3564 return parcel; 3567 return parcel;
3565 } 3568 }
@@ -4998,7 +5001,7 @@ namespace OpenSim.Region.Framework.Scenes
4998 private Vector3 GetPositionAtAvatarHeightOrGroundHeight(ScenePresence avatar, float x, float y) 5001 private Vector3 GetPositionAtAvatarHeightOrGroundHeight(ScenePresence avatar, float x, float y)
4999 { 5002 {
5000 Vector3 ground = GetPositionAtGround(x, y); 5003 Vector3 ground = GetPositionAtGround(x, y);
5001 if( avatar.AbsolutePosition.Z > ground.Z) 5004 if (avatar.AbsolutePosition.Z > ground.Z)
5002 { 5005 {
5003 ground.Z = avatar.AbsolutePosition.Z; 5006 ground.Z = avatar.AbsolutePosition.Z;
5004 } 5007 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 4e41b07..db70d6a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -510,94 +510,6 @@ namespace OpenSim.Region.Framework.Scenes
510 } 510 }
511 } 511 }
512 512
513 /// <summary>
514 /// Event Handling routine for Attach Object
515 /// </summary>
516 /// <param name="remoteClient"></param>
517 /// <param name="objectLocalID"></param>
518 /// <param name="AttachmentPt"></param>
519 /// <param name="rot"></param>
520 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
521 {
522 // If we can't take it, we can't attach it!
523 SceneObjectPart part = m_parentScene.GetSceneObjectPart(objectLocalID);
524 if (part == null)
525 return;
526
527 if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
528 return;
529
530 // Calls attach with a Zero position
531 if (m_parentScene.AttachmentsModule.AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
532 {
533 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
534
535 // Save avatar attachment information
536 ScenePresence presence;
537 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
538 {
539 m_log.Info(
540 "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
541 + ", AttachmentPoint: " + AttachmentPt);
542
543 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
544 }
545 }
546 }
547
548 /// <summary>
549 /// Rez an attachment
550 /// </summary>
551 /// <param name="remoteClient"></param>
552 /// <param name="itemID"></param>
553 /// <param name="AttachmentPt"></param>
554 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
555 public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
556 {
557 IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>();
558 if (invAccess != null)
559 {
560 SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
561 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
562 false, false, remoteClient.AgentId, true);
563
564// m_log.DebugFormat(
565// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
566// objatt.Name, remoteClient.Name, AttachmentPt);
567
568 if (objatt != null)
569 {
570 bool tainted = false;
571 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
572 tainted = true;
573
574 m_parentScene.AttachmentsModule.AttachObject(
575 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
576 //objatt.ScheduleGroupForFullUpdate();
577
578 if (tainted)
579 objatt.HasGroupChanged = true;
580
581 // Fire after attach, so we don't get messy perms dialogs
582 // 3 == AttachedRez
583 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
584
585 // Do this last so that event listeners have access to all the effects of the attachment
586 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
587 }
588 else
589 {
590 m_log.WarnFormat(
591 "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
592 itemID, remoteClient.Name, AttachmentPt);
593 }
594
595 return objatt;
596 }
597
598 return null;
599 }
600
601 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 513 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
602 { 514 {
603 ScenePresence newAvatar = null; 515 ScenePresence newAvatar = null;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6c4b39d..d083119 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Framework.Scenes
645 ApplyPhysics(m_scene.m_physicalPrim); 645 ApplyPhysics(m_scene.m_physicalPrim);
646 646
647 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 647 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
648 // for the same object with very different properties. The caller must schedule the update. 648 // for the same object with very different properties. The caller must schedule the update.
649 //ScheduleGroupForFullUpdate(); 649 //ScheduleGroupForFullUpdate();
650 } 650 }
651 651
@@ -2185,11 +2185,11 @@ namespace OpenSim.Region.Framework.Scenes
2185 /// Immediately send a full update for this scene object. 2185 /// Immediately send a full update for this scene object.
2186 /// </summary> 2186 /// </summary>
2187 public void SendGroupFullUpdate() 2187 public void SendGroupFullUpdate()
2188 { 2188 {
2189 if (IsDeleted) 2189 if (IsDeleted)
2190 return; 2190 return;
2191 2191
2192// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); 2192// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID);
2193 2193
2194 RootPart.SendFullUpdateToAllClients(); 2194 RootPart.SendFullUpdateToAllClients();
2195 2195
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c8ac014..48e34ee 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2060,6 +2060,7 @@ namespace OpenSim.Region.Framework.Scenes
2060 { 2060 {
2061 m_lastColliders.Remove(localID); 2061 m_lastColliders.Remove(localID);
2062 } 2062 }
2063
2063 if (m_parentGroup == null) 2064 if (m_parentGroup == null)
2064 return; 2065 return;
2065 if (m_parentGroup.IsDeleted) 2066 if (m_parentGroup.IsDeleted)
@@ -2855,7 +2856,7 @@ namespace OpenSim.Region.Framework.Scenes
2855 { 2856 {
2856 SendFullUpdateToClient(remoteClient, clientFlags); 2857 SendFullUpdateToClient(remoteClient, clientFlags);
2857 } 2858 }
2858 } 2859 }
2859 2860
2860 /// <summary> 2861 /// <summary>
2861 /// Send a full update for this part to all clients. 2862 /// Send a full update for this part to all clients.
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d8f93d7..24179a9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -686,7 +686,8 @@ namespace OpenSim.Region.Framework.Scenes
686 686
687 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 687 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
688 688
689 m_userLevel = account.UserLevel; 689 if (account != null)
690 m_userLevel = account.UserLevel;
690 691
691 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 692 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
692 if (gm != null) 693 if (gm != null)
@@ -3957,7 +3958,7 @@ namespace OpenSim.Region.Framework.Scenes
3957 { 3958 {
3958 if (null == m_appearance) 3959 if (null == m_appearance)
3959 { 3960 {
3960 m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); 3961 m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID);
3961 return; 3962 return;
3962 } 3963 }
3963 3964
@@ -3981,12 +3982,12 @@ namespace OpenSim.Region.Framework.Scenes
3981 try 3982 try
3982 { 3983 {
3983 // Rez from inventory 3984 // Rez from inventory
3984 UUID asset = m_scene.RezSingleAttachment(ControllingClient, 3985 UUID asset
3985 itemID, (uint)p); 3986 = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p);
3986
3987 m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3988 p, itemID, assetID, asset);
3989 3987
3988 m_log.InfoFormat(
3989 "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3990 p, itemID, assetID, asset);
3990 } 3991 }
3991 catch (Exception e) 3992 catch (Exception e)
3992 { 3993 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index b50d4ca..78f2ae3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -86,6 +86,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
86 public void TestDeleteSceneObjectAsync() 86 public void TestDeleteSceneObjectAsync()
87 { 87 {
88 TestHelper.InMethod(); 88 TestHelper.InMethod();
89 //log4net.Config.XmlConfigurator.Configure();
89 90
90 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 91 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
91 92
@@ -97,15 +98,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
97 98
98 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 99 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
99 100
100 try 101 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
101 { 102 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
102 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 103
103 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
104 }
105 catch (Exception e)
106 {
107 Console.WriteLine("Exception: " + e.StackTrace);
108 }
109 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 104 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
110 105
111 Assert.That(retrievedPart, Is.Not.Null); 106 Assert.That(retrievedPart, Is.Not.Null);