aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs237
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs11
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs171
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs16
13 files changed, 234 insertions, 281 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e5cf0dc..b532cd4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
79 public event DeRezObject OnDeRezObject; 79 public event DeRezObject OnDeRezObject;
80 public event ModifyTerrain OnModifyTerrain; 80 public event ModifyTerrain OnModifyTerrain;
81 public event Action<IClientAPI> OnRegionHandShakeReply; 81 public event Action<IClientAPI> OnRegionHandShakeReply;
82 public event GenericCall2 OnRequestWearables; 82 public event GenericCall1 OnRequestWearables;
83 public event SetAppearance OnSetAppearance; 83 public event SetAppearance OnSetAppearance;
84 public event AvatarNowWearing OnAvatarNowWearing; 84 public event AvatarNowWearing OnAvatarNowWearing;
85 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; 85 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -5681,11 +5681,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5681 5681
5682 private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack) 5682 private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack)
5683 { 5683 {
5684 GenericCall2 handlerRequestWearables = OnRequestWearables; 5684 GenericCall1 handlerRequestWearables = OnRequestWearables;
5685 5685
5686 if (handlerRequestWearables != null) 5686 if (handlerRequestWearables != null)
5687 { 5687 {
5688 handlerRequestWearables(); 5688 handlerRequestWearables(sender);
5689 } 5689 }
5690 5690
5691 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; 5691 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData;
@@ -5728,7 +5728,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5728 if (appear.ObjectData.TextureEntry.Length > 1) 5728 if (appear.ObjectData.TextureEntry.Length > 1)
5729 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 5729 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
5730 5730
5731 handlerSetAppearance(te, visualparams); 5731 handlerSetAppearance(sender, te, visualparams);
5732 } 5732 }
5733 catch (Exception e) 5733 catch (Exception e)
5734 { 5734 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index bf71c07..facf146 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -125,13 +125,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
125 125
126 // Save avatar attachment information 126 // Save avatar attachment information
127 ScenePresence presence; 127 ScenePresence presence;
128 if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 128 if (m_scene.AvatarService != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
129 { 129 {
130 m_log.Info( 130 m_log.Info(
131 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 131 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
132 + ", AttachmentPoint: " + AttachmentPt); 132 + ", AttachmentPoint: " + AttachmentPt);
133 133
134 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 134 m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance);
135 } 135 }
136 } 136 }
137 } 137 }
@@ -399,8 +399,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
399 item = m_scene.InventoryService.GetItem(item); 399 item = m_scene.InventoryService.GetItem(item);
400 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 400 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
401 401
402 if (m_scene.AvatarFactory != null) 402 if (m_scene.AvatarService != null)
403 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 403 m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance);
404 } 404 }
405 } 405 }
406 406
@@ -422,10 +422,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
422 presence.Appearance.DetachAttachment(itemID); 422 presence.Appearance.DetachAttachment(itemID);
423 423
424 // Save avatar attachment information 424 // Save avatar attachment information
425 if (m_scene.AvatarFactory != null) 425 if (m_scene.AvatarService != null)
426 { 426 {
427 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); 427 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
428 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 428 m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance);
429 } 429 }
430 } 430 }
431 431
@@ -452,9 +452,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
452 452
453 presence.Appearance.DetachAttachment(itemID); 453 presence.Appearance.DetachAttachment(itemID);
454 454
455 if (m_scene.AvatarFactory != null) 455 if (m_scene.AvatarService != null)
456 { 456 {
457 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 457 m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance);
458 } 458 }
459 part.ParentGroup.DetachToGround(); 459 part.ParentGroup.DetachToGround();
460 460
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 22c8937..9f7ff7f 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -38,48 +38,20 @@ using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
40{ 40{
41 public class AvatarFactoryModule : IAvatarFactory, IRegionModule 41 public class AvatarFactoryModule : IRegionModule
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
44 private Scene m_scene = null; 45 private Scene m_scene = null;
45 private static readonly AvatarAppearance def = new AvatarAppearance();
46 46
47 public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance) 47 private bool m_startAnimationSet = false;
48 {
49 AvatarData avatar = m_scene.AvatarService.GetAvatar(avatarId);
50 //if ((profile != null) && (profile.RootFolder != null))
51 if (avatar != null)
52 {
53 appearance = avatar.ToAvatarAppearance(avatarId);
54 return true;
55 }
56
57 m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId);
58 appearance = CreateDefault(avatarId);
59 return false;
60 }
61
62 private AvatarAppearance CreateDefault(UUID avatarId)
63 {
64 AvatarAppearance appearance = null;
65 AvatarWearable[] wearables;
66 byte[] visualParams;
67 GetDefaultAvatarAppearance(out wearables, out visualParams);
68 appearance = new AvatarAppearance(avatarId, wearables, visualParams);
69
70 return appearance;
71 }
72 48
73 public void Initialise(Scene scene, IConfigSource source) 49 public void Initialise(Scene scene, IConfigSource source)
74 { 50 {
75 scene.RegisterModuleInterface<IAvatarFactory>(this);
76 scene.EventManager.OnNewClient += NewClient; 51 scene.EventManager.OnNewClient += NewClient;
77 52
78 if (m_scene == null) 53 if (m_scene == null)
79 {
80 m_scene = scene; 54 m_scene = scene;
81 }
82
83 } 55 }
84 56
85 public void PostInitialise() 57 public void PostInitialise()
@@ -102,6 +74,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
102 74
103 public void NewClient(IClientAPI client) 75 public void NewClient(IClientAPI client)
104 { 76 {
77 client.OnRequestWearables += SendWearables;
78 client.OnSetAppearance += SetAppearance;
105 client.OnAvatarNowWearing += AvatarIsWearing; 79 client.OnAvatarNowWearing += AvatarIsWearing;
106 } 80 }
107 81
@@ -110,42 +84,115 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
110 // client.OnAvatarNowWearing -= AvatarIsWearing; 84 // client.OnAvatarNowWearing -= AvatarIsWearing;
111 } 85 }
112 86
113 public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) 87 /// <summary>
88 /// Set appearance data (textureentry and slider settings) received from the client
89 /// </summary>
90 /// <param name="texture"></param>
91 /// <param name="visualParam"></param>
92 public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
114 { 93 {
115 IInventoryService invService = m_scene.InventoryService; 94 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
95 if (sp == null)
96 {
97 m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId);
98 return;
99 }
100
101// DEBUG ON
102 m_log.WarnFormat("[AVFACTORY] SetAppearance for {0}",client.AgentId);
103// DEBUG OFF
116 104
117 if (invService.GetRootFolder(userID) != null) 105/*
106 if (m_physicsActor != null)
118 { 107 {
119 for (int i = 0; i < 13; i++) 108 if (!IsChildAgent)
120 { 109 {
121 if (appearance.Wearables[i].ItemID == UUID.Zero) 110 // This may seem like it's redundant, remove the avatar from the physics scene
122 { 111 // just to add it back again, but it saves us from having to update
123 appearance.Wearables[i].AssetID = UUID.Zero; 112 // 3 variables 10 times a second.
124 } 113 bool flyingTemp = m_physicsActor.Flying;
125 else 114 RemoveFromPhysicalScene();
126 { 115 //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
127 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
128 baseItem = invService.GetItem(baseItem);
129 116
130 if (baseItem != null) 117 //PhysicsActor = null;
131 { 118
132 appearance.Wearables[i].AssetID = baseItem.AssetID; 119 AddToPhysicalScene(flyingTemp);
133 } 120 }
134 else 121 }
122*/
123 #region Bake Cache Check
124
125 bool changed = false;
126
127 // Process the texture entry
128 if (textureEntry != null)
129 {
130 for (int i = 0; i < BAKE_INDICES.Length; i++)
131 {
132 int j = BAKE_INDICES[i];
133 Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
134
135 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
136 {
137 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
135 { 138 {
136 m_log.ErrorFormat( 139 m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}",face.TextureID,j,this.Name);
137 "[APPEARANCE]: Can't find inventory item {0} for {1}, setting to default", 140 client.SendRebakeAvatarTextures(face.TextureID);
138 appearance.Wearables[i].ItemID, (WearableType)i);
139
140 appearance.Wearables[i].AssetID = def.Wearables[i].AssetID;
141 } 141 }
142 } 142 }
143 } 143 }
144 changed = sp.Appearance.SetTextureEntries(textureEntry);
145
146 }
147
148 #endregion Bake Cache Check
149
150 changed = sp.Appearance.SetVisualParams(visualParams) || changed;
151
152 // If nothing changed (this happens frequently) just return
153 if (changed)
154 {
155// DEBUG ON
156 m_log.Warn("[AVFACTORY] Appearance changed");
157// DEBUG OFF
158 sp.Appearance.SetAppearance(textureEntry, visualParams);
159 if (sp.Appearance.AvatarHeight > 0)
160 sp.SetHeight(sp.Appearance.AvatarHeight);
161
162 m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance);
144 } 163 }
164// DEBUG ON
145 else 165 else
166 m_log.Warn("[AVFACTORY] Appearance did not change");
167// DEBUG OFF
168
169 sp.SendAppearanceToAllOtherAgents();
170 if (!m_startAnimationSet)
171 {
172 sp.Animator.UpdateMovementAnimations();
173 m_startAnimationSet = true;
174 }
175
176 client.SendAvatarDataImmediate(sp);
177 client.SendAppearance(sp.Appearance.Owner,sp.Appearance.VisualParams,sp.Appearance.Texture.GetBytes());
178 }
179
180 /// <summary>
181 /// Tell the client for this scene presence what items it should be wearing now
182 /// </summary>
183 public void SendWearables(IClientAPI client)
184 {
185 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
186 if (sp == null)
146 { 187 {
147 m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); 188 m_log.WarnFormat("[AVFACTORY] SendWearables unable to find presence for {0}",client.AgentId);
189 return;
148 } 190 }
191
192// DEBUG ON
193 m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId);
194// DEBUG OFF
195 client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++);
149 } 196 }
150 197
151 /// <summary> 198 /// <summary>
@@ -153,65 +200,81 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
153 /// </summary> 200 /// </summary>
154 /// <param name="sender"></param> 201 /// <param name="sender"></param>
155 /// <param name="e"></param> 202 /// <param name="e"></param>
156 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 203 public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e)
157 { 204 {
158 m_log.DebugFormat("[APPEARANCE]: AvatarIsWearing"); 205 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
159 206 if (sp == null)
160 IClientAPI clientView = (IClientAPI)sender;
161 ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId);
162
163 if (sp == null)
164 { 207 {
165 m_log.Error("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); 208 m_log.WarnFormat("[AVFACTORY] AvatarIsWearing unable to find presence for {0}",client.AgentId);
166 return; 209 return;
167 } 210 }
211
212// DEBUG ON
213 m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}",client.AgentId);
214// DEBUG OFF
215
216 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance);
168 217
169 AvatarAppearance avatAppearance = sp.Appearance; 218 //if (!TryGetAvatarAppearance(client.AgentId, out avatAppearance))
170 //if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
171 //{ 219 //{
172 // m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); 220 // m_log.Warn("[AVFACTORY]: We didn't seem to find the appearance, falling back to ScenePresence");
173 // avatAppearance = sp.Appearance; 221 // avatAppearance = sp.Appearance;
174 //} 222 //}
175 223
176 //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); 224 //m_log.DebugFormat("[AVFACTORY]: Received wearables for {0}", client.Name);
177 225
178 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 226 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
179 { 227 {
180 if (wear.Type < 13) 228 if (wear.Type < AvatarWearable.MAX_WEARABLES)
181 { 229 {
182 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; 230 AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero);
231 avatAppearance.SetWearable(wear.Type, newWearable);
183 } 232 }
184 } 233 }
185 234
186 SetAppearanceAssets(sp.UUID, ref avatAppearance); 235 SetAppearanceAssets(sp.UUID, ref avatAppearance);
187 AvatarData adata = new AvatarData(avatAppearance);
188 m_scene.AvatarService.SetAvatar(clientView.AgentId, adata);
189 236
237 m_scene.AvatarService.SetAppearance(client.AgentId, avatAppearance);
190 sp.Appearance = avatAppearance; 238 sp.Appearance = avatAppearance;
191 } 239 }
192 240
193 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 241 private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
194 { 242 {
195 visualParams = GetDefaultVisualParams(); 243 IInventoryService invService = m_scene.InventoryService;
196 wearables = AvatarWearable.DefaultWearables;
197 }
198 244
199 public void UpdateDatabase(UUID user, AvatarAppearance appearance) 245 if (invService.GetRootFolder(userID) != null)
200 { 246 {
201 //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); 247 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
202 AvatarData adata = new AvatarData(appearance); 248 {
203 m_scene.AvatarService.SetAvatar(user, adata); 249 if (appearance.Wearables[i].ItemID == UUID.Zero)
204 } 250 {
251 appearance.Wearables[i].AssetID = UUID.Zero;
252 }
253 else
254 {
255 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
256 baseItem = invService.GetItem(baseItem);
205 257
206 private static byte[] GetDefaultVisualParams() 258 if (baseItem != null)
207 { 259 {
208 byte[] visualParams; 260 appearance.Wearables[i].AssetID = baseItem.AssetID;
209 visualParams = new byte[218]; 261 }
210 for (int i = 0; i < 218; i++) 262 else
263 {
264 m_log.ErrorFormat(
265 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
266 appearance.Wearables[i].ItemID, (WearableType)i);
267
268 appearance.Wearables[i].ItemID = UUID.Zero;
269 appearance.Wearables[i].AssetID = UUID.Zero;
270 }
271 }
272 }
273 }
274 else
211 { 275 {
212 visualParams[i] = 100; 276 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
213 } 277 }
214 return visualParams;
215 } 278 }
216 } 279 }
217} 280}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
index 47f19a3..9ee19f8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35using OpenSim.Server.Base; 36using OpenSim.Server.Base;
@@ -137,6 +138,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
137 138
138 #region IAvatarService 139 #region IAvatarService
139 140
141 public AvatarAppearance GetAppearance(UUID userID)
142 {
143 return m_AvatarService.GetAppearance(userID);
144 }
145
146 public bool SetAppearance(UUID userID, AvatarAppearance appearance)
147 {
148 return m_AvatarService.SetAppearance(userID,appearance);
149 }
150
140 public AvatarData GetAvatar(UUID userID) 151 public AvatarData GetAvatar(UUID userID)
141 { 152 {
142 return m_AvatarService.GetAvatar(userID); 153 return m_AvatarService.GetAvatar(userID);
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index db427b4..09f615f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Examples.SimpleModule
82 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; 82 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
83 public event DeRezObject OnDeRezObject; 83 public event DeRezObject OnDeRezObject;
84 public event Action<IClientAPI> OnRegionHandShakeReply; 84 public event Action<IClientAPI> OnRegionHandShakeReply;
85 public event GenericCall2 OnRequestWearables; 85 public event GenericCall1 OnRequestWearables;
86 public event GenericCall1 OnCompleteMovementToRegion; 86 public event GenericCall1 OnCompleteMovementToRegion;
87 public event UpdateAgent OnPreAgentUpdate; 87 public event UpdateAgent OnPreAgentUpdate;
88 public event UpdateAgent OnAgentUpdate; 88 public event UpdateAgent OnAgentUpdate;
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
deleted file mode 100644
index c967f30..0000000
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ /dev/null
@@ -1,38 +0,0 @@
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 OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IAvatarFactory
34 {
35 bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance);
36 void UpdateDatabase(UUID userID, AvatarAppearance avatAppearance);
37 }
38}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c3edeb3..f0f8d55 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -120,7 +120,6 @@ namespace OpenSim.Region.Framework.Scenes
120 120
121 protected IXMLRPC m_xmlrpcModule; 121 protected IXMLRPC m_xmlrpcModule;
122 protected IWorldComm m_worldCommModule; 122 protected IWorldComm m_worldCommModule;
123 protected IAvatarFactory m_AvatarFactory;
124 protected IConfigSource m_config; 123 protected IConfigSource m_config;
125 protected IRegionSerialiserModule m_serialiser; 124 protected IRegionSerialiserModule m_serialiser;
126 protected IDialogModule m_dialogModule; 125 protected IDialogModule m_dialogModule;
@@ -415,11 +414,6 @@ namespace OpenSim.Region.Framework.Scenes
415 414
416 public IAttachmentsModule AttachmentsModule { get; set; } 415 public IAttachmentsModule AttachmentsModule { get; set; }
417 416
418 public IAvatarFactory AvatarFactory
419 {
420 get { return m_AvatarFactory; }
421 }
422
423 public ICapabilitiesModule CapsModule 417 public ICapabilitiesModule CapsModule
424 { 418 {
425 get { return m_capsModule; } 419 get { return m_capsModule; }
@@ -1193,7 +1187,6 @@ namespace OpenSim.Region.Framework.Scenes
1193 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); 1187 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
1194 m_worldCommModule = RequestModuleInterface<IWorldComm>(); 1188 m_worldCommModule = RequestModuleInterface<IWorldComm>();
1195 XferManager = RequestModuleInterface<IXfer>(); 1189 XferManager = RequestModuleInterface<IXfer>();
1196 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1197 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); 1190 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
1198 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1191 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1199 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1192 m_dialogModule = RequestModuleInterface<IDialogModule>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7bf0a99..8cbf4dc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -76,7 +76,6 @@ namespace OpenSim.Region.Framework.Scenes
76 76
77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78 78
79 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
80// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 79// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
81 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 80 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
82 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 81 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -143,8 +142,6 @@ namespace OpenSim.Region.Framework.Scenes
143 142
144 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 143 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
145 144
146 private bool m_startAnimationSet;
147
148 //private Vector3 m_requestedSitOffset = new Vector3(); 145 //private Vector3 m_requestedSitOffset = new Vector3();
149 146
150 private Vector3 m_LastFinitePos; 147 private Vector3 m_LastFinitePos;
@@ -778,13 +775,14 @@ namespace OpenSim.Region.Framework.Scenes
778 SetDirectionVectors(); 775 SetDirectionVectors();
779 } 776 }
780 777
778/*
781 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 779 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
782 AvatarWearable[] wearables) 780 AvatarWearable[] wearables)
783 : this(client, world, reginfo) 781 : this(client, world, reginfo)
784 { 782 {
785 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); 783 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
786 } 784 }
787 785*/
788 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 786 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
789 : this(client, world, reginfo) 787 : this(client, world, reginfo)
790 { 788 {
@@ -798,8 +796,6 @@ namespace OpenSim.Region.Framework.Scenes
798 796
799 public void RegisterToEvents() 797 public void RegisterToEvents()
800 { 798 {
801 m_controllingClient.OnRequestWearables += SendWearables;
802 m_controllingClient.OnSetAppearance += SetAppearance;
803 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 799 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
804 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 800 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
805 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 801 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
@@ -1208,7 +1204,7 @@ namespace OpenSim.Region.Framework.Scenes
1208 /// <summary> 1204 /// <summary>
1209 /// Sets avatar height in the phyiscs plugin 1205 /// Sets avatar height in the phyiscs plugin
1210 /// </summary> 1206 /// </summary>
1211 internal void SetHeight(float height) 1207 public void SetHeight(float height)
1212 { 1208 {
1213 m_avHeight = height; 1209 m_avHeight = height;
1214 if (PhysicsActor != null && !IsChildAgent) 1210 if (PhysicsActor != null && !IsChildAgent)
@@ -1272,7 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes
1272 if (friendsModule != null) 1268 if (friendsModule != null)
1273 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1269 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1274 } 1270 }
1275
1276 } 1271 }
1277 1272
1278 /// <summary> 1273 /// <summary>
@@ -2742,9 +2737,12 @@ namespace OpenSim.Region.Framework.Scenes
2742 if (m_appearance.Texture == null) 2737 if (m_appearance.Texture == null)
2743 return; 2738 return;
2744 2739
2745 Vector3 pos = m_pos; 2740 if (IsChildAgent)
2746 pos.Z += m_appearance.HipOffset; 2741 {
2747 2742 m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data");
2743 return;
2744 }
2745
2748 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); 2746 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
2749 m_scene.StatsReporter.AddAgentUpdates(1); 2747 m_scene.StatsReporter.AddAgentUpdates(1);
2750 } 2748 }
@@ -2787,6 +2785,12 @@ namespace OpenSim.Region.Framework.Scenes
2787 m_perfMonMS = Util.EnvironmentTickCount(); 2785 m_perfMonMS = Util.EnvironmentTickCount();
2788 2786
2789 // only send update from root agents to other clients; children are only "listening posts" 2787 // only send update from root agents to other clients; children are only "listening posts"
2788 if (IsChildAgent)
2789 {
2790 m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
2791 return;
2792 }
2793
2790 int count = 0; 2794 int count = 0;
2791 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 2795 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2792 { 2796 {
@@ -2810,29 +2814,20 @@ namespace OpenSim.Region.Framework.Scenes
2810 // the inventory arrives 2814 // the inventory arrives
2811 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2815 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2812 2816
2813 Vector3 pos = m_pos;
2814 pos.Z += m_appearance.HipOffset;
2815
2816 m_controllingClient.SendAvatarDataImmediate(this); 2817 m_controllingClient.SendAvatarDataImmediate(this);
2818 m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
2817 2819
2818 SendInitialFullUpdateToAllClients(); 2820 SendInitialFullUpdateToAllClients();
2819 } 2821 }
2820 2822
2821 /// <summary> 2823 /// <summary>
2822 /// Tell the client for this scene presence what items it should be wearing now
2823 /// </summary>
2824 public void SendWearables()
2825 {
2826 m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
2827
2828 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2829 }
2830
2831 /// <summary>
2832 /// 2824 ///
2833 /// </summary> 2825 /// </summary>
2834 public void SendAppearanceToAllOtherAgents() 2826 public void SendAppearanceToAllOtherAgents()
2835 { 2827 {
2828// DEBUG ON
2829 m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid);
2830// DEBUG OFF
2836 m_perfMonMS = Util.EnvironmentTickCount(); 2831 m_perfMonMS = Util.EnvironmentTickCount();
2837 2832
2838 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2833 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2852,96 +2847,13 @@ namespace OpenSim.Region.Framework.Scenes
2852 /// <param name="avatar"></param> 2847 /// <param name="avatar"></param>
2853 public void SendAppearanceToOtherAgent(ScenePresence avatar) 2848 public void SendAppearanceToOtherAgent(ScenePresence avatar)
2854 { 2849 {
2850// DEBUG ON
2851 m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2852// DEBUG OFF
2855 avatar.ControllingClient.SendAppearance( 2853 avatar.ControllingClient.SendAppearance(
2856 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2854 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
2857 } 2855 }
2858 2856
2859 /// <summary>
2860 /// Set appearance data (textureentry and slider settings) received from the client
2861 /// </summary>
2862 /// <param name="texture"></param>
2863 /// <param name="visualParam"></param>
2864 public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
2865 {
2866 lock (m_syncRoot)
2867 {
2868// MT: Commented this because it's no longer needed.
2869// It used to be that the avatar height was calculated from the visual
2870// params, so any call to this method could change the physical actor's
2871// height. Now the height is supplied in the agent circuit data and never
2872// changes here. So, we can leave physics alone.
2873//
2874// if (m_physicsActor != null)
2875// {
2876// if (!IsChildAgent)
2877// {
2878// // This may seem like it's redundant, remove the avatar from the physics scene
2879// // just to add it back again, but it saves us from having to update
2880// // 3 variables 10 times a second.
2881// bool flyingTemp = m_physicsActor.Flying;
2882// RemoveFromPhysicalScene();
2883// //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
2884//
2885// //PhysicsActor = null;
2886//
2887// AddToPhysicalScene(flyingTemp);
2888// }
2889// }
2890
2891 #region Bake Cache Check
2892
2893 if (textureEntry != null)
2894 {
2895 for (int i = 0; i < BAKE_INDICES.Length; i++)
2896 {
2897 int j = BAKE_INDICES[i];
2898 Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
2899
2900 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
2901 {
2902 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
2903 {
2904 m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
2905 this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
2906 }
2907 }
2908 }
2909
2910 }
2911
2912
2913 #endregion Bake Cache Check
2914
2915 m_appearance.SetAppearance(textureEntry, visualParams);
2916 if (m_appearance.AvatarHeight > 0)
2917 SetHeight(m_appearance.AvatarHeight);
2918
2919 // This is not needed, because only the transient data changed
2920 //AvatarData adata = new AvatarData(m_appearance);
2921 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2922
2923 SendAppearanceToAllOtherAgents();
2924 if (!m_startAnimationSet)
2925 {
2926 Animator.UpdateMovementAnimations();
2927 m_startAnimationSet = true;
2928 }
2929
2930 Vector3 pos = m_pos;
2931 pos.Z += m_appearance.HipOffset;
2932
2933 m_controllingClient.SendAvatarDataImmediate(this);
2934 }
2935 }
2936
2937 public void SetWearable(int wearableId, AvatarWearable wearable)
2938 {
2939 m_appearance.SetWearable(wearableId, wearable);
2940 AvatarData adata = new AvatarData(m_appearance);
2941 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2942 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2943 }
2944
2945 // Because appearance setting is in a module, we actually need 2857 // Because appearance setting is in a module, we actually need
2946 // to give it access to our appearance directly, otherwise we 2858 // to give it access to our appearance directly, otherwise we
2947 // get a synchronization issue. 2859 // get a synchronization issue.
@@ -3335,6 +3247,8 @@ namespace OpenSim.Region.Framework.Scenes
3335 3247
3336 public void CopyTo(AgentData cAgent) 3248 public void CopyTo(AgentData cAgent)
3337 { 3249 {
3250 cAgent.CallbackURI = m_callbackURI;
3251
3338 cAgent.AgentID = UUID; 3252 cAgent.AgentID = UUID;
3339 cAgent.RegionID = Scene.RegionInfo.RegionID; 3253 cAgent.RegionID = Scene.RegionInfo.RegionID;
3340 3254
@@ -3374,6 +3288,9 @@ namespace OpenSim.Region.Framework.Scenes
3374 3288
3375 cAgent.AlwaysRun = m_setAlwaysRun; 3289 cAgent.AlwaysRun = m_setAlwaysRun;
3376 3290
3291 cAgent.Appearance = new AvatarAppearance(m_appearance);
3292
3293/*
3377 try 3294 try
3378 { 3295 {
3379 // We might not pass the Wearables in all cases... 3296 // We might not pass the Wearables in all cases...
@@ -3413,14 +3330,14 @@ namespace OpenSim.Region.Framework.Scenes
3413 { 3330 {
3414 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); 3331 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3415 int i = 0; 3332 int i = 0;
3416 AttachmentData[] attachs = new AttachmentData[attPoints.Count]; 3333 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3417 foreach (int point in attPoints) 3334 foreach (int point in attPoints)
3418 { 3335 {
3419 attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); 3336 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3420 } 3337 }
3421 cAgent.Attachments = attachs; 3338 cAgent.Attachments = attachs;
3422 } 3339 }
3423 3340*/
3424 lock (scriptedcontrols) 3341 lock (scriptedcontrols)
3425 { 3342 {
3426 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3343 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3447,6 +3364,9 @@ namespace OpenSim.Region.Framework.Scenes
3447 3364
3448 public void CopyFrom(AgentData cAgent) 3365 public void CopyFrom(AgentData cAgent)
3449 { 3366 {
3367// DEBUG ON
3368 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
3369// DEBUG OFF
3450 m_originRegionID = cAgent.RegionID; 3370 m_originRegionID = cAgent.RegionID;
3451 3371
3452 m_callbackURI = cAgent.CallbackURI; 3372 m_callbackURI = cAgent.CallbackURI;
@@ -3473,6 +3393,9 @@ namespace OpenSim.Region.Framework.Scenes
3473 m_godLevel = cAgent.GodLevel; 3393 m_godLevel = cAgent.GodLevel;
3474 m_setAlwaysRun = cAgent.AlwaysRun; 3394 m_setAlwaysRun = cAgent.AlwaysRun;
3475 3395
3396 m_appearance = new AvatarAppearance(cAgent.Appearance);
3397
3398/*
3476 uint i = 0; 3399 uint i = 0;
3477 try 3400 try
3478 { 3401 {
@@ -3485,15 +3408,17 @@ namespace OpenSim.Region.Framework.Scenes
3485 UUID assetId = cAgent.Wearables[n + 1]; 3408 UUID assetId = cAgent.Wearables[n + 1];
3486 wears[i++] = new AvatarWearable(itemId, assetId); 3409 wears[i++] = new AvatarWearable(itemId, assetId);
3487 } 3410 }
3488 m_appearance.Wearables = wears; 3411 // m_appearance.Wearables = wears;
3489 Primitive.TextureEntry te; 3412 Primitive.TextureEntry textures = null;
3490 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) 3413 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3491 te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); 3414 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3492 else 3415
3493 te = AvatarAppearance.GetDefaultTexture(); 3416 byte[] visuals = null;
3494 if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) 3417
3495 cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); 3418 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3496 m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); 3419 visuals = (byte[])cAgent.VisualParams.Clone();
3420
3421 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3497 } 3422 }
3498 catch (Exception e) 3423 catch (Exception e)
3499 { 3424 {
@@ -3506,14 +3431,14 @@ namespace OpenSim.Region.Framework.Scenes
3506 if (cAgent.Attachments != null) 3431 if (cAgent.Attachments != null)
3507 { 3432 {
3508 m_appearance.ClearAttachments(); 3433 m_appearance.ClearAttachments();
3509 foreach (AttachmentData att in cAgent.Attachments) 3434 foreach (AvatarAttachment att in cAgent.Attachments)
3510 { 3435 {
3511 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); 3436 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3512 } 3437 }
3513 } 3438 }
3514 } 3439 }
3515 catch { } 3440 catch { }
3516 3441*/
3517 try 3442 try
3518 { 3443 {
3519 lock (scriptedcontrols) 3444 lock (scriptedcontrols)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 72e5ebd..96c3d8e 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -676,7 +676,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
676 public event TeleportLandmarkRequest OnTeleportLandmarkRequest; 676 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
677 public event DeRezObject OnDeRezObject; 677 public event DeRezObject OnDeRezObject;
678 public event Action<IClientAPI> OnRegionHandShakeReply; 678 public event Action<IClientAPI> OnRegionHandShakeReply;
679 public event GenericCall2 OnRequestWearables; 679 public event GenericCall1 OnRequestWearables;
680 public event GenericCall1 OnCompleteMovementToRegion; 680 public event GenericCall1 OnCompleteMovementToRegion;
681 public event UpdateAgent OnPreAgentUpdate; 681 public event UpdateAgent OnPreAgentUpdate;
682 public event UpdateAgent OnAgentUpdate; 682 public event UpdateAgent OnAgentUpdate;
@@ -909,7 +909,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
909 Scene scene = (Scene)Scene; 909 Scene scene = (Scene)Scene;
910 AvatarAppearance appearance; 910 AvatarAppearance appearance;
911 scene.GetAvatarAppearance(this, out appearance); 911 scene.GetAvatarAppearance(this, out appearance);
912 OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); 912 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone());
913 } 913 }
914 914
915 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) 915 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
index d8f7a84..3f1bd54 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
@@ -32,7 +32,7 @@ using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
32 32
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 34{
35 class ExtensionHandler : IExtension 35 class ExtensionHandler : IExtension
36 { 36 {
37 private readonly Dictionary<Type, object> m_instances; 37 private readonly Dictionary<Type, object> m_instances;
38 38
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index f47e71c..df60709 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -291,7 +291,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
291 291
292 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) 292 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID)
293 { 293 {
294
295 m_log.Info("[MRM] Created MRM Instance"); 294 m_log.Info("[MRM] Created MRM Instance");
296 295
297 IWorld world; 296 IWorld world;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 3cbe391..737ca1b 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -188,7 +188,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
188 188
189 public event DeRezObject OnDeRezObject; 189 public event DeRezObject OnDeRezObject;
190 public event Action<IClientAPI> OnRegionHandShakeReply; 190 public event Action<IClientAPI> OnRegionHandShakeReply;
191 public event GenericCall2 OnRequestWearables; 191 public event GenericCall1 OnRequestWearables;
192 public event GenericCall1 OnCompleteMovementToRegion; 192 public event GenericCall1 OnCompleteMovementToRegion;
193 public event UpdateAgent OnPreAgentUpdate; 193 public event UpdateAgent OnPreAgentUpdate;
194 public event UpdateAgent OnAgentUpdate; 194 public event UpdateAgent OnAgentUpdate;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index ab0be77..c471636 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -64,15 +64,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
64 if (m_appearanceCache.ContainsKey(target)) 64 if (m_appearanceCache.ContainsKey(target))
65 return m_appearanceCache[target]; 65 return m_appearanceCache[target];
66 66
67 AvatarData adata = scene.AvatarService.GetAvatar(target); 67 AvatarAppearance appearance = scene.AvatarService.GetAppearance(target);
68 if (adata != null) 68 if (appearance != null)
69 { 69 {
70 AvatarAppearance x = adata.ToAvatarAppearance(target); 70 m_appearanceCache.Add(target, appearance);
71 71 return appearance;
72 m_appearanceCache.Add(target, x);
73
74 return x;
75 } 72 }
73
76 return new AvatarAppearance(); 74 return new AvatarAppearance();
77 } 75 }
78 76
@@ -169,7 +167,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
169 { 167 {
170 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); 168 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
171 169
172 sp.SetAppearance(x.Texture, (byte[])x.VisualParams.Clone()); 170 sp.Appearance.SetTextureEntries(x.Texture);
171 sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone());
172 sp.SendAppearanceToAllOtherAgents();
173 } 173 }
174 174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);