diff options
Diffstat (limited to '')
6 files changed, 103 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 02fd387..f6aea89 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -95,6 +95,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
95 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; | 95 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; |
96 | client.OnObjectDrop -= DetachSingleAttachmentToGround; | 96 | client.OnObjectDrop -= DetachSingleAttachmentToGround; |
97 | } | 97 | } |
98 | |||
99 | /// <summary> | ||
100 | /// RezAttachments. This should only be called upon login on the first region. | ||
101 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
102 | /// </summary> | ||
103 | public void RezAttachments(IScenePresence sp) | ||
104 | { | ||
105 | if (null == sp.Appearance) | ||
106 | { | ||
107 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); | ||
112 | foreach (AvatarAttachment attach in attachments) | ||
113 | { | ||
114 | int p = attach.AttachPoint; | ||
115 | UUID itemID = attach.ItemID; | ||
116 | |||
117 | //UUID assetID = attach.AssetID; | ||
118 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | ||
119 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | ||
120 | //if (UUID.Zero == assetID) | ||
121 | //{ | ||
122 | // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); | ||
123 | // continue; | ||
124 | //} | ||
125 | |||
126 | try | ||
127 | { | ||
128 | RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, (uint)p); | ||
129 | } | ||
130 | catch (Exception e) | ||
131 | { | ||
132 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); | ||
133 | } | ||
134 | } | ||
135 | } | ||
98 | 136 | ||
99 | /// <summary> | 137 | /// <summary> |
100 | /// Called by client | 138 | /// Called by client |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index c910289..1833dce 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -36,6 +36,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
36 | public interface IAttachmentsModule | 36 | public interface IAttachmentsModule |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// RezAttachments. This should only be called upon login on the first region. | ||
40 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
41 | /// </summary> | ||
42 | void RezAttachments(IScenePresence sp); | ||
43 | |||
44 | /// <summary> | ||
39 | /// Attach an object to an avatar from the world. | 45 | /// Attach an object to an avatar from the world. |
40 | /// </summary> | 46 | /// </summary> |
41 | /// <param name="controllingClient"></param> | 47 | /// <param name="controllingClient"></param> |
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs new file mode 100644 index 0000000..d700d79 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs | |||
@@ -0,0 +1,56 @@ | |||
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 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// An agent in the scene. | ||
35 | /// </summary> | ||
36 | /// <remarks> | ||
37 | /// Interface is a work in progress. Please feel free to add other required properties and methods. | ||
38 | /// </remarks> | ||
39 | public interface IScenePresence : ISceneEntity | ||
40 | { | ||
41 | /// <value> | ||
42 | /// The client controlling this presence | ||
43 | /// </value> | ||
44 | IClientAPI ControllingClient { get; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Avatar appearance data. | ||
48 | /// </summary> | ||
49 | /// <remarks> | ||
50 | // Because appearance setting is in a module, we actually need | ||
51 | // to give it access to our appearance directly, otherwise we | ||
52 | // get a synchronization issue. | ||
53 | /// </remarks> | ||
54 | AvatarAppearance Appearance { get; set; } | ||
55 | } | ||
56 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e0250de..e7fe8df 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2578,7 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2578 | if (aCircuit.child == false) | 2578 | if (aCircuit.child == false) |
2579 | { | 2579 | { |
2580 | sp.IsChildAgent = false; | 2580 | sp.IsChildAgent = false; |
2581 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | 2581 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
2582 | } | 2582 | } |
2583 | } | 2583 | } |
2584 | 2584 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4143d44..040e801 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | 66 | ||
67 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); | 67 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); |
68 | 68 | ||
69 | public class ScenePresence : EntityBase, ISceneEntity | 69 | public class ScenePresence : EntityBase, IScenePresence |
70 | { | 70 | { |
71 | // ~ScenePresence() | 71 | // ~ScenePresence() |
72 | // { | 72 | // { |
@@ -444,9 +444,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
444 | 444 | ||
445 | protected PhysicsActor m_physicsActor; | 445 | protected PhysicsActor m_physicsActor; |
446 | 446 | ||
447 | /// <value> | ||
448 | /// The client controlling this presence | ||
449 | /// </value> | ||
450 | public IClientAPI ControllingClient | 447 | public IClientAPI ControllingClient |
451 | { | 448 | { |
452 | get { return m_controllingClient; } | 449 | get { return m_controllingClient; } |
@@ -2689,9 +2686,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2689 | UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2686 | UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
2690 | } | 2687 | } |
2691 | 2688 | ||
2692 | // Because appearance setting is in a module, we actually need | ||
2693 | // to give it access to our appearance directly, otherwise we | ||
2694 | // get a synchronization issue. | ||
2695 | public AvatarAppearance Appearance | 2689 | public AvatarAppearance Appearance |
2696 | { | 2690 | { |
2697 | get { return m_appearance; } | 2691 | get { return m_appearance; } |
@@ -3813,44 +3807,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3813 | return flags; | 3807 | return flags; |
3814 | } | 3808 | } |
3815 | 3809 | ||
3816 | /// <summary> | ||
3817 | /// RezAttachments. This should only be called upon login on the first region. | ||
3818 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
3819 | /// </summary> | ||
3820 | public void RezAttachments() | ||
3821 | { | ||
3822 | if (null == m_appearance) | ||
3823 | { | ||
3824 | m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID); | ||
3825 | return; | ||
3826 | } | ||
3827 | |||
3828 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); | ||
3829 | foreach (AvatarAttachment attach in attachments) | ||
3830 | { | ||
3831 | int p = attach.AttachPoint; | ||
3832 | UUID itemID = attach.ItemID; | ||
3833 | |||
3834 | //UUID assetID = attach.AssetID; | ||
3835 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | ||
3836 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | ||
3837 | //if (UUID.Zero == assetID) | ||
3838 | //{ | ||
3839 | // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); | ||
3840 | // continue; | ||
3841 | //} | ||
3842 | |||
3843 | try | ||
3844 | { | ||
3845 | m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p); | ||
3846 | } | ||
3847 | catch (Exception e) | ||
3848 | { | ||
3849 | m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); | ||
3850 | } | ||
3851 | } | ||
3852 | } | ||
3853 | |||
3854 | private void ReprioritizeUpdates() | 3810 | private void ReprioritizeUpdates() |
3855 | { | 3811 | { |
3856 | if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) | 3812 | if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index c1da803..79c79e4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -155,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
155 | 155 | ||
156 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); | 156 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); |
157 | sp.Appearance = npcAppearance; | 157 | sp.Appearance = npcAppearance; |
158 | sp.RezAttachments(); | 158 | scene.AttachmentsModule.RezAttachments(sp); |
159 | 159 | ||
160 | IAvatarFactory module = scene.RequestModuleInterface<IAvatarFactory>(); | 160 | IAvatarFactory module = scene.RequestModuleInterface<IAvatarFactory>(); |
161 | module.SendAppearance(sp.UUID); | 161 | module.SendAppearance(sp.UUID); |