diff options
Diffstat (limited to 'OpenSim/Region')
23 files changed, 432 insertions, 357 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 74ad485..14f923d 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; |
@@ -5647,11 +5647,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5647 | 5647 | ||
5648 | private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack) | 5648 | private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack) |
5649 | { | 5649 | { |
5650 | GenericCall2 handlerRequestWearables = OnRequestWearables; | 5650 | GenericCall1 handlerRequestWearables = OnRequestWearables; |
5651 | 5651 | ||
5652 | if (handlerRequestWearables != null) | 5652 | if (handlerRequestWearables != null) |
5653 | { | 5653 | { |
5654 | handlerRequestWearables(); | 5654 | handlerRequestWearables(sender); |
5655 | } | 5655 | } |
5656 | 5656 | ||
5657 | Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; | 5657 | Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; |
@@ -5694,7 +5694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5694 | if (appear.ObjectData.TextureEntry.Length > 1) | 5694 | if (appear.ObjectData.TextureEntry.Length > 1) |
5695 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 5695 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
5696 | 5696 | ||
5697 | handlerSetAppearance(te, visualparams); | 5697 | handlerSetAppearance(sender, te, visualparams); |
5698 | } | 5698 | } |
5699 | catch (Exception e) | 5699 | catch (Exception e) |
5700 | { | 5700 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2a0c0b1..ad6b1de 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -124,13 +124,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
124 | 124 | ||
125 | // Save avatar attachment information | 125 | // Save avatar attachment information |
126 | ScenePresence presence; | 126 | ScenePresence presence; |
127 | if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 127 | if (m_scene.AvatarService != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
128 | { | 128 | { |
129 | m_log.Info( | 129 | m_log.Info( |
130 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | 130 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId |
131 | + ", AttachmentPoint: " + AttachmentPt); | 131 | + ", AttachmentPoint: " + AttachmentPt); |
132 | 132 | ||
133 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 133 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
@@ -382,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
382 | item = m_scene.InventoryService.GetItem(item); | 382 | item = m_scene.InventoryService.GetItem(item); |
383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
384 | 384 | ||
385 | if (m_scene.AvatarFactory != null) | 385 | if (m_scene.AvatarService != null) |
386 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 386 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
@@ -405,10 +405,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
405 | presence.Appearance.DetachAttachment(itemID); | 405 | presence.Appearance.DetachAttachment(itemID); |
406 | 406 | ||
407 | // Save avatar attachment information | 407 | // Save avatar attachment information |
408 | if (m_scene.AvatarFactory != null) | 408 | if (m_scene.AvatarService != null) |
409 | { | 409 | { |
410 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); | 410 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); |
411 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 411 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
@@ -435,9 +435,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
435 | 435 | ||
436 | presence.Appearance.DetachAttachment(itemID); | 436 | presence.Appearance.DetachAttachment(itemID); |
437 | 437 | ||
438 | if (m_scene.AvatarFactory != null) | 438 | if (m_scene.AvatarService != null) |
439 | { | 439 | { |
440 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 440 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
441 | } | 441 | } |
442 | part.ParentGroup.DetachToGround(); | 442 | part.ParentGroup.DetachToGround(); |
443 | 443 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 22c8937..5f8b4f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -32,58 +32,56 @@ using Nini.Config; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | 34 | ||
35 | using System.Threading; | ||
36 | using System.Timers; | ||
37 | using System.Collections.Generic; | ||
38 | |||
35 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
38 | 42 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 43 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
40 | { | 44 | { |
41 | public class AvatarFactoryModule : IAvatarFactory, IRegionModule | 45 | public class AvatarFactoryModule : IRegionModule |
42 | { | 46 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | ||
44 | private Scene m_scene = null; | 49 | private Scene m_scene = null; |
45 | private static readonly AvatarAppearance def = new AvatarAppearance(); | ||
46 | 50 | ||
47 | public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance) | 51 | private int m_savetime = 5; // seconds to wait before saving changed appearance |
48 | { | 52 | private int m_sendtime = 2; // seconds to wait before sending changed appearance |
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 | 53 | ||
57 | m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId); | 54 | private int m_checkTime = 500; // milliseconds to wait between checks for appearance updates |
58 | appearance = CreateDefault(avatarId); | 55 | private System.Timers.Timer m_updateTimer = new System.Timers.Timer(); |
59 | return false; | 56 | private Dictionary<UUID,long> m_savequeue = new Dictionary<UUID,long>(); |
60 | } | 57 | private Dictionary<UUID,long> m_sendqueue = new Dictionary<UUID,long>(); |
61 | 58 | ||
62 | private AvatarAppearance CreateDefault(UUID avatarId) | 59 | #region RegionModule Members |
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 | 60 | ||
73 | public void Initialise(Scene scene, IConfigSource source) | 61 | public void Initialise(Scene scene, IConfigSource config) |
74 | { | 62 | { |
75 | scene.RegisterModuleInterface<IAvatarFactory>(this); | ||
76 | scene.EventManager.OnNewClient += NewClient; | 63 | scene.EventManager.OnNewClient += NewClient; |
77 | 64 | ||
78 | if (m_scene == null) | 65 | if (config != null) |
79 | { | 66 | { |
80 | m_scene = scene; | 67 | IConfig sconfig = config.Configs["Startup"]; |
68 | if (sconfig != null) | ||
69 | { | ||
70 | m_savetime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); | ||
71 | m_sendtime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); | ||
72 | } | ||
81 | } | 73 | } |
82 | 74 | ||
75 | if (m_scene == null) | ||
76 | m_scene = scene; | ||
83 | } | 77 | } |
84 | 78 | ||
85 | public void PostInitialise() | 79 | public void PostInitialise() |
86 | { | 80 | { |
81 | m_updateTimer.Enabled = false; | ||
82 | m_updateTimer.AutoReset = true; | ||
83 | m_updateTimer.Interval = m_checkTime; // 500 milliseconds wait to start async ops | ||
84 | m_updateTimer.Elapsed += new ElapsedEventHandler(HandleAppearanceUpdateTimer); | ||
87 | } | 85 | } |
88 | 86 | ||
89 | public void Close() | 87 | public void Close() |
@@ -102,6 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
102 | 100 | ||
103 | public void NewClient(IClientAPI client) | 101 | public void NewClient(IClientAPI client) |
104 | { | 102 | { |
103 | client.OnRequestWearables += SendWearables; | ||
104 | client.OnSetAppearance += SetAppearance; | ||
105 | client.OnAvatarNowWearing += AvatarIsWearing; | 105 | client.OnAvatarNowWearing += AvatarIsWearing; |
106 | } | 106 | } |
107 | 107 | ||
@@ -110,42 +110,211 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
110 | // client.OnAvatarNowWearing -= AvatarIsWearing; | 110 | // client.OnAvatarNowWearing -= AvatarIsWearing; |
111 | } | 111 | } |
112 | 112 | ||
113 | public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) | 113 | #endregion |
114 | |||
115 | /// <summary> | ||
116 | /// Set appearance data (textureentry and slider settings) received from the client | ||
117 | /// </summary> | ||
118 | /// <param name="texture"></param> | ||
119 | /// <param name="visualParam"></param> | ||
120 | public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
114 | { | 121 | { |
115 | IInventoryService invService = m_scene.InventoryService; | 122 | // DEBUG ON |
123 | m_log.WarnFormat("[AVFACTORY] SetAppearance for {0}",client.AgentId); | ||
124 | // DEBUG OFF | ||
116 | 125 | ||
117 | if (invService.GetRootFolder(userID) != null) | 126 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
127 | if (sp == null) | ||
118 | { | 128 | { |
119 | for (int i = 0; i < 13; i++) | 129 | m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId); |
130 | return; | ||
131 | } | ||
132 | |||
133 | bool changed = false; | ||
134 | |||
135 | // Process the texture entry | ||
136 | if (textureEntry != null) | ||
137 | { | ||
138 | changed = sp.Appearance.SetTextureEntries(textureEntry); | ||
139 | |||
140 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
120 | { | 141 | { |
121 | if (appearance.Wearables[i].ItemID == UUID.Zero) | 142 | int idx = BAKE_INDICES[i]; |
143 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | ||
144 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
145 | Util.FireAndForget(delegate(object o) { CheckBakedTextureAssets(client,face.TextureID,idx); }); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | // Process the visual params, this may change height as well | ||
150 | if (visualParams != null) | ||
151 | { | ||
152 | if (sp.Appearance.SetVisualParams(visualParams)) | ||
153 | { | ||
154 | changed = true; | ||
155 | if (sp.Appearance.AvatarHeight > 0) | ||
156 | sp.SetHeight(sp.Appearance.AvatarHeight); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | // If something changed in the appearance then queue an appearance save | ||
161 | if (changed) | ||
162 | QueueAppearanceSave(client.AgentId); | ||
163 | |||
164 | // And always queue up an appearance update to send out | ||
165 | QueueAppearanceSend(client.AgentId); | ||
166 | |||
167 | // Send the appearance back to the avatar | ||
168 | AvatarAppearance avp = sp.Appearance; | ||
169 | sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
170 | sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); | ||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// Checks for the existance of a baked texture asset and | ||
175 | /// requests the viewer rebake if the asset is not found | ||
176 | /// </summary> | ||
177 | /// <param name="client"></param> | ||
178 | /// <param name="textureID"></param> | ||
179 | /// <param name="idx"></param> | ||
180 | private void CheckBakedTextureAssets(IClientAPI client, UUID textureID, int idx) | ||
181 | { | ||
182 | if (m_scene.AssetService.Get(textureID.ToString()) == null) | ||
183 | { | ||
184 | m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}", | ||
185 | textureID,idx,client.Name); | ||
186 | client.SendRebakeAvatarTextures(textureID); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | #region UpdateAppearanceTimer | ||
191 | |||
192 | public void QueueAppearanceSend(UUID agentid) | ||
193 | { | ||
194 | // DEBUG ON | ||
195 | m_log.WarnFormat("[AVFACTORY] Queue appearance send for {0}",agentid); | ||
196 | // DEBUG OFF | ||
197 | |||
198 | // 100 nanoseconds (ticks) we should wait | ||
199 | long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 10000000); | ||
200 | lock (m_sendqueue) | ||
201 | { | ||
202 | m_sendqueue[agentid] = timestamp; | ||
203 | m_updateTimer.Start(); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | public void QueueAppearanceSave(UUID agentid) | ||
208 | { | ||
209 | // DEBUG ON | ||
210 | m_log.WarnFormat("[AVFACTORY] Queue appearance save for {0}",agentid); | ||
211 | // DEBUG OFF | ||
212 | |||
213 | // 100 nanoseconds (ticks) we should wait | ||
214 | long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 10000000); | ||
215 | lock (m_savequeue) | ||
216 | { | ||
217 | m_savequeue[agentid] = timestamp; | ||
218 | m_updateTimer.Start(); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private void HandleAppearanceSend(UUID agentid) | ||
223 | { | ||
224 | ScenePresence sp = m_scene.GetScenePresence(agentid); | ||
225 | if (sp == null) | ||
226 | { | ||
227 | m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); | ||
228 | return; | ||
229 | } | ||
230 | |||
231 | // DEBUG ON | ||
232 | m_log.WarnFormat("[AVFACTORY] Handle appearance send for {0}\n{1}",agentid,sp.Appearance.ToString()); | ||
233 | // DEBUG OFF | ||
234 | |||
235 | // Send the appearance to everyone in the scene | ||
236 | sp.SendAppearanceToAllOtherAgents(); | ||
237 | |||
238 | // Send the appearance back to the avatar | ||
239 | AvatarAppearance avp = sp.Appearance; | ||
240 | sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
241 | sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); | ||
242 | |||
243 | /* | ||
244 | // this needs to be fixed, the flag should be on scene presence not the region module | ||
245 | // Start the animations if necessary | ||
246 | if (!m_startAnimationSet) | ||
247 | { | ||
248 | sp.Animator.UpdateMovementAnimations(); | ||
249 | m_startAnimationSet = true; | ||
250 | } | ||
251 | */ | ||
252 | } | ||
253 | |||
254 | private void HandleAppearanceSave(UUID agentid) | ||
255 | { | ||
256 | ScenePresence sp = m_scene.GetScenePresence(agentid); | ||
257 | if (sp == null) | ||
258 | { | ||
259 | m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); | ||
260 | return; | ||
261 | } | ||
262 | |||
263 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); | ||
264 | } | ||
265 | |||
266 | private void HandleAppearanceUpdateTimer(object sender, EventArgs ea) | ||
267 | { | ||
268 | long now = DateTime.Now.Ticks; | ||
269 | |||
270 | lock (m_sendqueue) | ||
271 | { | ||
272 | Dictionary<UUID,long> sends = new Dictionary<UUID,long>(m_sendqueue); | ||
273 | foreach (KeyValuePair<UUID,long> kvp in sends) | ||
274 | { | ||
275 | if (kvp.Value < now) | ||
122 | { | 276 | { |
123 | appearance.Wearables[i].AssetID = UUID.Zero; | 277 | Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); |
278 | m_sendqueue.Remove(kvp.Key); | ||
124 | } | 279 | } |
125 | else | 280 | } |
126 | { | 281 | } |
127 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); | ||
128 | baseItem = invService.GetItem(baseItem); | ||
129 | 282 | ||
130 | if (baseItem != null) | 283 | lock (m_savequeue) |
131 | { | 284 | { |
132 | appearance.Wearables[i].AssetID = baseItem.AssetID; | 285 | Dictionary<UUID,long> saves = new Dictionary<UUID,long>(m_savequeue); |
133 | } | 286 | foreach (KeyValuePair<UUID,long> kvp in saves) |
134 | else | 287 | { |
135 | { | 288 | if (kvp.Value < now) |
136 | m_log.ErrorFormat( | 289 | { |
137 | "[APPEARANCE]: Can't find inventory item {0} for {1}, setting to default", | 290 | Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); |
138 | appearance.Wearables[i].ItemID, (WearableType)i); | 291 | m_savequeue.Remove(kvp.Key); |
139 | |||
140 | appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; | ||
141 | } | ||
142 | } | 292 | } |
143 | } | 293 | } |
144 | } | 294 | } |
145 | else | 295 | |
296 | if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) | ||
297 | m_updateTimer.Stop(); | ||
298 | } | ||
299 | |||
300 | #endregion | ||
301 | |||
302 | /// <summary> | ||
303 | /// Tell the client for this scene presence what items it should be wearing now | ||
304 | /// </summary> | ||
305 | public void SendWearables(IClientAPI client) | ||
306 | { | ||
307 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | ||
308 | if (sp == null) | ||
146 | { | 309 | { |
147 | m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); | 310 | m_log.WarnFormat("[AVFACTORY] SendWearables unable to find presence for {0}",client.AgentId); |
311 | return; | ||
148 | } | 312 | } |
313 | |||
314 | // DEBUG ON | ||
315 | m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId); | ||
316 | // DEBUG OFF | ||
317 | client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++); | ||
149 | } | 318 | } |
150 | 319 | ||
151 | /// <summary> | 320 | /// <summary> |
@@ -153,65 +322,81 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
153 | /// </summary> | 322 | /// </summary> |
154 | /// <param name="sender"></param> | 323 | /// <param name="sender"></param> |
155 | /// <param name="e"></param> | 324 | /// <param name="e"></param> |
156 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) | 325 | public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e) |
157 | { | 326 | { |
158 | m_log.DebugFormat("[APPEARANCE]: AvatarIsWearing"); | 327 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
159 | 328 | if (sp == null) | |
160 | IClientAPI clientView = (IClientAPI)sender; | ||
161 | ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId); | ||
162 | |||
163 | if (sp == null) | ||
164 | { | 329 | { |
165 | m_log.Error("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); | 330 | m_log.WarnFormat("[AVFACTORY] AvatarIsWearing unable to find presence for {0}",client.AgentId); |
166 | return; | 331 | return; |
167 | } | 332 | } |
333 | |||
334 | // DEBUG ON | ||
335 | m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}",client.AgentId); | ||
336 | // DEBUG OFF | ||
337 | |||
338 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance); | ||
168 | 339 | ||
169 | AvatarAppearance avatAppearance = sp.Appearance; | 340 | //if (!TryGetAvatarAppearance(client.AgentId, out avatAppearance)) |
170 | //if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) | ||
171 | //{ | 341 | //{ |
172 | // m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); | 342 | // m_log.Warn("[AVFACTORY]: We didn't seem to find the appearance, falling back to ScenePresence"); |
173 | // avatAppearance = sp.Appearance; | 343 | // avatAppearance = sp.Appearance; |
174 | //} | 344 | //} |
175 | 345 | ||
176 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); | 346 | //m_log.DebugFormat("[AVFACTORY]: Received wearables for {0}", client.Name); |
177 | 347 | ||
178 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 348 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
179 | { | 349 | { |
180 | if (wear.Type < 13) | 350 | if (wear.Type < AvatarWearable.MAX_WEARABLES) |
181 | { | 351 | { |
182 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | 352 | AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero); |
353 | avatAppearance.SetWearable(wear.Type, newWearable); | ||
183 | } | 354 | } |
184 | } | 355 | } |
185 | 356 | ||
186 | SetAppearanceAssets(sp.UUID, ref avatAppearance); | 357 | SetAppearanceAssets(sp.UUID, ref avatAppearance); |
187 | AvatarData adata = new AvatarData(avatAppearance); | ||
188 | m_scene.AvatarService.SetAvatar(clientView.AgentId, adata); | ||
189 | 358 | ||
359 | m_scene.AvatarService.SetAppearance(client.AgentId, avatAppearance); | ||
190 | sp.Appearance = avatAppearance; | 360 | sp.Appearance = avatAppearance; |
191 | } | 361 | } |
192 | 362 | ||
193 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 363 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
194 | { | 364 | { |
195 | visualParams = GetDefaultVisualParams(); | 365 | IInventoryService invService = m_scene.InventoryService; |
196 | wearables = AvatarWearable.DefaultWearables; | ||
197 | } | ||
198 | 366 | ||
199 | public void UpdateDatabase(UUID user, AvatarAppearance appearance) | 367 | if (invService.GetRootFolder(userID) != null) |
200 | { | 368 | { |
201 | //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); | 369 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
202 | AvatarData adata = new AvatarData(appearance); | 370 | { |
203 | m_scene.AvatarService.SetAvatar(user, adata); | 371 | if (appearance.Wearables[i].ItemID == UUID.Zero) |
204 | } | 372 | { |
373 | appearance.Wearables[i].AssetID = UUID.Zero; | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); | ||
378 | baseItem = invService.GetItem(baseItem); | ||
205 | 379 | ||
206 | private static byte[] GetDefaultVisualParams() | 380 | if (baseItem != null) |
207 | { | 381 | { |
208 | byte[] visualParams; | 382 | appearance.Wearables[i].AssetID = baseItem.AssetID; |
209 | visualParams = new byte[218]; | 383 | } |
210 | for (int i = 0; i < 218; i++) | 384 | else |
385 | { | ||
386 | m_log.ErrorFormat( | ||
387 | "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", | ||
388 | appearance.Wearables[i].ItemID, (WearableType)i); | ||
389 | |||
390 | appearance.Wearables[i].ItemID = UUID.Zero; | ||
391 | appearance.Wearables[i].AssetID = UUID.Zero; | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | } | ||
396 | else | ||
211 | { | 397 | { |
212 | visualParams[i] = 100; | 398 | m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); |
213 | } | 399 | } |
214 | return visualParams; | ||
215 | } | 400 | } |
216 | } | 401 | } |
217 | } | 402 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index d76ff47..4359c01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
238 | } | 238 | } |
239 | 239 | ||
240 | (scene as Scene).EventManager.TriggerOnChatToClients( | 240 | (scene as Scene).EventManager.TriggerOnChatToClients( |
241 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); | 241 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); |
242 | } | 242 | } |
243 | 243 | ||
244 | static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); | 244 | static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 5500557..046b05f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
143 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) | 143 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
144 | { | 144 | { |
145 | LoadControlFile(filePath, data); | 145 | LoadControlFile(filePath, data); |
146 | } | 146 | } |
147 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 147 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
148 | { | 148 | { |
149 | if (LoadAsset(filePath, data)) | 149 | if (LoadAsset(filePath, data)) |
@@ -479,11 +479,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
479 | /// <param name="path"></param> | 479 | /// <param name="path"></param> |
480 | /// <param name="data"></param> | 480 | /// <param name="data"></param> |
481 | protected void LoadControlFile(string path, byte[] data) | 481 | protected void LoadControlFile(string path, byte[] data) |
482 | { | 482 | { |
483 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); | 483 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); |
484 | XElement archiveElement = doc.Element("archive"); | 484 | XElement archiveElement = doc.Element("archive"); |
485 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); | 485 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); |
486 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); | 486 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); |
487 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); | 487 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); |
488 | 488 | ||
489 | if (majorVersion > MAX_MAJOR_VERSION) | 489 | if (majorVersion > MAX_MAJOR_VERSION) |
@@ -492,7 +492,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
492 | string.Format( | 492 | string.Format( |
493 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", | 493 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", |
494 | majorVersion, MAX_MAJOR_VERSION)); | 494 | majorVersion, MAX_MAJOR_VERSION)); |
495 | } | 495 | } |
496 | 496 | ||
497 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | 497 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); |
498 | } | 498 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 249a8b4..9080e1c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
213 | public void Execute() | 213 | public void Execute() |
214 | { | 214 | { |
215 | try | 215 | try |
216 | { | 216 | { |
217 | InventoryFolderBase inventoryFolder = null; | 217 | InventoryFolderBase inventoryFolder = null; |
218 | InventoryItemBase inventoryItem = null; | 218 | InventoryItemBase inventoryItem = null; |
219 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 219 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
@@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
277 | // Write out control file. This has to be done first so that subsequent loaders will see this file first | 277 | // Write out control file. This has to be done first so that subsequent loaders will see this file first |
278 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this | 278 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this |
279 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | 279 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); |
280 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); | 280 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); |
281 | 281 | ||
282 | if (inventoryFolder != null) | 282 | if (inventoryFolder != null) |
283 | { | 283 | { |
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; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Server.Base; | 36 | using 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/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 1687d06..3182079 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -199,13 +199,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
199 | { | 199 | { |
200 | majorVersion = 1; | 200 | majorVersion = 1; |
201 | minorVersion = 0; | 201 | minorVersion = 0; |
202 | } | 202 | } |
203 | */ | 203 | */ |
204 | 204 | ||
205 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); | 205 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); |
206 | // if (majorVersion == 1) | 206 | // if (majorVersion == 1) |
207 | // { | 207 | // { |
208 | // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); | 208 | // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); |
209 | // } | 209 | // } |
210 | 210 | ||
211 | 211 | ||
@@ -232,6 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
232 | sw.Close(); | 232 | sw.Close(); |
233 | 233 | ||
234 | return s; | 234 | return s; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index a6dc2ec..cea7c78 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules | |||
44 | /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. | 44 | /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. |
45 | /// </summary> | 45 | /// </summary> |
46 | 46 | ||
47 | |||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 48 | ||
50 | |||
51 | // | 49 | // |
52 | // Global Constants used to determine where in the sky the sun is | 50 | // Global Constants used to determine where in the sky the sun is |
53 | // | 51 | // |
@@ -108,26 +106,25 @@ namespace OpenSim.Region.CoreModules | |||
108 | private Scene m_scene = null; | 106 | private Scene m_scene = null; |
109 | 107 | ||
110 | // Calculated Once in the lifetime of a region | 108 | // Calculated Once in the lifetime of a region |
111 | private long TicksToEpoch; // Elapsed time for 1/1/1970 | 109 | private long TicksToEpoch; // Elapsed time for 1/1/1970 |
112 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds | 110 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds |
113 | private uint SecondsPerYear; // Length of a virtual year in RW seconds | 111 | private uint SecondsPerYear; // Length of a virtual year in RW seconds |
114 | private double SunSpeed; // Rate of passage in radians/second | 112 | private double SunSpeed; // Rate of passage in radians/second |
115 | private double SeasonSpeed; // Rate of change for seasonal effects | 113 | private double SeasonSpeed; // Rate of change for seasonal effects |
116 | // private double HoursToRadians; // Rate of change for seasonal effects | 114 | // private double HoursToRadians; // Rate of change for seasonal effects |
117 | private long TicksUTCOffset = 0; // seconds offset from UTC | 115 | private long TicksUTCOffset = 0; // seconds offset from UTC |
118 | // Calculated every update | 116 | // Calculated every update |
119 | private float OrbitalPosition; // Orbital placement at a point in time | 117 | private float OrbitalPosition; // Orbital placement at a point in time |
120 | private double HorizonShift; // Axis offset to skew day and night | 118 | private double HorizonShift; // Axis offset to skew day and night |
121 | private double TotalDistanceTravelled; // Distance since beginning of time (in radians) | 119 | private double TotalDistanceTravelled; // Distance since beginning of time (in radians) |
122 | private double SeasonalOffset; // Seaonal variation of tilt | 120 | private double SeasonalOffset; // Seaonal variation of tilt |
123 | private float Magnitude; // Normal tilt | 121 | private float Magnitude; // Normal tilt |
124 | // private double VWTimeRatio; // VW time as a ratio of real time | 122 | // private double VWTimeRatio; // VW time as a ratio of real time |
125 | 123 | ||
126 | // Working values | 124 | // Working values |
127 | private Vector3 Position = Vector3.Zero; | 125 | private Vector3 Position = Vector3.Zero; |
128 | private Vector3 Velocity = Vector3.Zero; | 126 | private Vector3 Velocity = Vector3.Zero; |
129 | private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); | 127 | private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); |
130 | |||
131 | 128 | ||
132 | // Used to fix the sun in the sky so it doesn't move based on current time | 129 | // Used to fix the sun in the sky so it doesn't move based on current time |
133 | private bool m_SunFixed = false; | 130 | private bool m_SunFixed = false; |
@@ -135,8 +132,6 @@ namespace OpenSim.Region.CoreModules | |||
135 | 132 | ||
136 | private const int TICKS_PER_SECOND = 10000000; | 133 | private const int TICKS_PER_SECOND = 10000000; |
137 | 134 | ||
138 | |||
139 | |||
140 | // Current time in elapsed seconds since Jan 1st 1970 | 135 | // Current time in elapsed seconds since Jan 1st 1970 |
141 | private ulong CurrentTime | 136 | private ulong CurrentTime |
142 | { | 137 | { |
@@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules | |||
149 | // Time in seconds since UTC to use to calculate sun position. | 144 | // Time in seconds since UTC to use to calculate sun position. |
150 | ulong PosTime = 0; | 145 | ulong PosTime = 0; |
151 | 146 | ||
152 | |||
153 | |||
154 | /// <summary> | 147 | /// <summary> |
155 | /// Calculate the sun's orbital position and its velocity. | 148 | /// Calculate the sun's orbital position and its velocity. |
156 | /// </summary> | 149 | /// </summary> |
@@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules | |||
202 | PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); | 195 | PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); |
203 | } | 196 | } |
204 | } | 197 | } |
205 | |||
206 | } | 198 | } |
207 | 199 | ||
208 | TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians | 200 | TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians |
@@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules | |||
251 | Velocity.X = 0; | 243 | Velocity.X = 0; |
252 | Velocity.Y = 0; | 244 | Velocity.Y = 0; |
253 | Velocity.Z = 0; | 245 | Velocity.Z = 0; |
254 | |||
255 | } | 246 | } |
256 | else | 247 | else |
257 | { | 248 | { |
@@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules | |||
271 | private float GetCurrentTimeAsLindenSunHour() | 262 | private float GetCurrentTimeAsLindenSunHour() |
272 | { | 263 | { |
273 | if (m_SunFixed) | 264 | if (m_SunFixed) |
274 | { | ||
275 | return m_SunFixedHour + 6; | 265 | return m_SunFixedHour + 6; |
276 | } | ||
277 | 266 | ||
278 | return GetCurrentSunHour() + 6.0f; | 267 | return GetCurrentSunHour() + 6.0f; |
279 | } | 268 | } |
@@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules | |||
297 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); | 286 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); |
298 | } | 287 | } |
299 | 288 | ||
300 | |||
301 | |||
302 | TimeZone local = TimeZone.CurrentTimeZone; | 289 | TimeZone local = TimeZone.CurrentTimeZone; |
303 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | 290 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; |
304 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); | 291 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); |
@@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules | |||
325 | // must hard code to ~.5 to match sun position in LL based viewers | 312 | // must hard code to ~.5 to match sun position in LL based viewers |
326 | m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); | 313 | m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); |
327 | 314 | ||
328 | |||
329 | // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours | 315 | // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours |
330 | m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); | 316 | m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); |
331 | 317 | ||
332 | // Update frequency in frames | 318 | // Update frequency in frames |
333 | m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); | 319 | m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); |
334 | |||
335 | } | 320 | } |
336 | catch (Exception e) | 321 | catch (Exception e) |
337 | { | 322 | { |
@@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules | |||
391 | } | 376 | } |
392 | 377 | ||
393 | scene.RegisterModuleInterface<ISunModule>(this); | 378 | scene.RegisterModuleInterface<ISunModule>(this); |
394 | |||
395 | } | 379 | } |
396 | 380 | ||
397 | |||
398 | public void PostInitialise() | 381 | public void PostInitialise() |
399 | { | 382 | { |
400 | } | 383 | } |
@@ -402,7 +385,7 @@ namespace OpenSim.Region.CoreModules | |||
402 | public void Close() | 385 | public void Close() |
403 | { | 386 | { |
404 | ready = false; | 387 | ready = false; |
405 | 388 | ||
406 | // Remove our hooks | 389 | // Remove our hooks |
407 | m_scene.EventManager.OnFrame -= SunUpdate; | 390 | m_scene.EventManager.OnFrame -= SunUpdate; |
408 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | 391 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; |
@@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules | |||
419 | { | 402 | { |
420 | get { return false; } | 403 | get { return false; } |
421 | } | 404 | } |
405 | |||
422 | #endregion | 406 | #endregion |
423 | 407 | ||
424 | #region EventManager Events | 408 | #region EventManager Events |
@@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules | |||
446 | public void SunUpdate() | 430 | public void SunUpdate() |
447 | { | 431 | { |
448 | if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) | 432 | if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) |
449 | { | ||
450 | return; | 433 | return; |
451 | } | ||
452 | 434 | ||
453 | GenSunPos(); // Generate shared values once | 435 | GenSunPos(); // Generate shared values once |
454 | 436 | ||
@@ -467,7 +449,7 @@ namespace OpenSim.Region.CoreModules | |||
467 | } | 449 | } |
468 | 450 | ||
469 | /// <summary> | 451 | /// <summary> |
470 | /// | 452 | /// |
471 | /// </summary> | 453 | /// </summary> |
472 | /// <param name="regionHandle"></param> | 454 | /// <param name="regionHandle"></param> |
473 | /// <param name="FixedTime">Is the sun's position fixed?</param> | 455 | /// <param name="FixedTime">Is the sun's position fixed?</param> |
@@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules | |||
484 | while (FixedSunHour < 0) | 466 | while (FixedSunHour < 0) |
485 | FixedSunHour += 24; | 467 | FixedSunHour += 24; |
486 | 468 | ||
487 | |||
488 | m_SunFixedHour = FixedSunHour; | 469 | m_SunFixedHour = FixedSunHour; |
489 | m_SunFixed = FixedSun; | 470 | m_SunFixed = FixedSun; |
490 | 471 | ||
@@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules | |||
499 | // When sun settings are updated, we should update all clients with new settings. | 480 | // When sun settings are updated, we should update all clients with new settings. |
500 | SunUpdateToAllClients(); | 481 | SunUpdateToAllClients(); |
501 | 482 | ||
502 | |||
503 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); | 483 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); |
504 | } | 484 | } |
505 | } | 485 | } |
506 | 486 | ||
507 | #endregion | 487 | #endregion |
508 | 488 | ||
509 | |||
510 | private void SunUpdateToAllClients() | 489 | private void SunUpdateToAllClients() |
511 | { | 490 | { |
512 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 491 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules | |||
553 | { | 532 | { |
554 | float ticksleftover = CurrentTime % SecondsPerSunCycle; | 533 | float ticksleftover = CurrentTime % SecondsPerSunCycle; |
555 | 534 | ||
556 | |||
557 | return (24.0f * (ticksleftover / SecondsPerSunCycle)); | 535 | return (24.0f * (ticksleftover / SecondsPerSunCycle)); |
558 | } | 536 | } |
559 | 537 | ||
@@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules | |||
666 | 644 | ||
667 | // When sun settings are updated, we should update all clients with new settings. | 645 | // When sun settings are updated, we should update all clients with new settings. |
668 | SunUpdateToAllClients(); | 646 | SunUpdateToAllClients(); |
669 | |||
670 | } | 647 | } |
671 | 648 | ||
672 | return Output; | 649 | return Output; |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 268612e..f128aa2 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 | 82 | ||
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 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace 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/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4feb3fc..c321a15 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -296,7 +296,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | /// ChatToClientsEvent is triggered via ChatModule (or | 296 | /// ChatToClientsEvent is triggered via ChatModule (or |
297 | /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a | 297 | /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a |
298 | /// received chat message if they satisfy various conditions (within audible range, etc.) | 298 | /// received chat message if they satisfy various conditions (within audible range, etc.) |
299 | /// </summary> | 299 | /// </summary> |
300 | public delegate void ChatToClientsEvent( | 300 | public delegate void ChatToClientsEvent( |
301 | UUID senderID, HashSet<UUID> receiverIDs, | 301 | UUID senderID, HashSet<UUID> receiverIDs, |
302 | string message, ChatTypeEnum type, Vector3 fromPos, string fromName, | 302 | string message, ChatTypeEnum type, Vector3 fromPos, string fromName, |
@@ -1636,8 +1636,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1636 | e.Message, e.StackTrace); | 1636 | e.Message, e.StackTrace); |
1637 | } | 1637 | } |
1638 | } | 1638 | } |
1639 | } | 1639 | } |
1640 | } | 1640 | } |
1641 | 1641 | ||
1642 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) | 1642 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) |
1643 | { | 1643 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4878b3e..f77fb2c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -119,7 +119,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | protected IXMLRPC m_xmlrpcModule; | 120 | protected IXMLRPC m_xmlrpcModule; |
121 | protected IWorldComm m_worldCommModule; | 121 | protected IWorldComm m_worldCommModule; |
122 | protected IAvatarFactory m_AvatarFactory; | ||
123 | protected IConfigSource m_config; | 122 | protected IConfigSource m_config; |
124 | protected IRegionSerialiserModule m_serialiser; | 123 | protected IRegionSerialiserModule m_serialiser; |
125 | protected IDialogModule m_dialogModule; | 124 | protected IDialogModule m_dialogModule; |
@@ -399,11 +398,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | 398 | ||
400 | public IAttachmentsModule AttachmentsModule { get; set; } | 399 | public IAttachmentsModule AttachmentsModule { get; set; } |
401 | 400 | ||
402 | public IAvatarFactory AvatarFactory | ||
403 | { | ||
404 | get { return m_AvatarFactory; } | ||
405 | } | ||
406 | |||
407 | public ICapabilitiesModule CapsModule | 401 | public ICapabilitiesModule CapsModule |
408 | { | 402 | { |
409 | get { return m_capsModule; } | 403 | get { return m_capsModule; } |
@@ -1159,7 +1153,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1159 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); | 1153 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); |
1160 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); | 1154 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); |
1161 | XferManager = RequestModuleInterface<IXfer>(); | 1155 | XferManager = RequestModuleInterface<IXfer>(); |
1162 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | ||
1163 | AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); | 1156 | AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); |
1164 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1157 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1165 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1158 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
@@ -3278,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3278 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); | 3271 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); |
3279 | } | 3272 | } |
3280 | 3273 | ||
3281 | |||
3282 | /// <summary> | 3274 | /// <summary> |
3283 | /// Do the work necessary to initiate a new user connection for a particular scene. | 3275 | /// Do the work necessary to initiate a new user connection for a particular scene. |
3284 | /// At the moment, this consists of setting up the caps infrastructure | 3276 | /// At the moment, this consists of setting up the caps infrastructure |
@@ -3291,6 +3283,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3291 | /// also return a reason.</returns> | 3283 | /// also return a reason.</returns> |
3292 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3284 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) |
3293 | { | 3285 | { |
3286 | return NewUserConnection(agent, teleportFlags, out reason, true); | ||
3287 | } | ||
3288 | |||
3289 | /// <summary> | ||
3290 | /// Do the work necessary to initiate a new user connection for a particular scene. | ||
3291 | /// At the moment, this consists of setting up the caps infrastructure | ||
3292 | /// The return bool should allow for connections to be refused, but as not all calling paths | ||
3293 | /// take proper notice of it let, we allowed banned users in still. | ||
3294 | /// </summary> | ||
3295 | /// <param name="agent">CircuitData of the agent who is connecting</param> | ||
3296 | /// <param name="reason">Outputs the reason for the false response on this string</param> | ||
3297 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC | ||
3298 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> | ||
3299 | /// <returns>True if the region accepts this agent. False if it does not. False will | ||
3300 | /// also return a reason.</returns> | ||
3301 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) | ||
3302 | { | ||
3294 | bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || | 3303 | bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || |
3295 | (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); | 3304 | (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); |
3296 | reason = String.Empty; | 3305 | reason = String.Empty; |
@@ -3339,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3339 | 3348 | ||
3340 | if (sp == null) // We don't have an [child] agent here already | 3349 | if (sp == null) // We don't have an [child] agent here already |
3341 | { | 3350 | { |
3342 | 3351 | if (requirePresenceLookup) | |
3343 | try | ||
3344 | { | 3352 | { |
3345 | if (!VerifyUserPresence(agent, out reason)) | 3353 | try |
3354 | { | ||
3355 | if (!VerifyUserPresence(agent, out reason)) | ||
3356 | return false; | ||
3357 | } | ||
3358 | catch (Exception e) | ||
3359 | { | ||
3360 | m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); | ||
3346 | return false; | 3361 | return false; |
3347 | } | 3362 | } |
3348 | catch (Exception e) | ||
3349 | { | ||
3350 | m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); | ||
3351 | return false; | ||
3352 | } | 3363 | } |
3353 | 3364 | ||
3354 | try | 3365 | try |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f81c551..24d7334 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) | 406 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) |
407 | { | 407 | { |
408 | EntityBase entity; | 408 | EntityBase entity; |
409 | if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) | 409 | if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) |
410 | return false; | 410 | return false; |
411 | 411 | ||
412 | SceneObjectGroup grp = (SceneObjectGroup)entity; | 412 | SceneObjectGroup grp = (SceneObjectGroup)entity; |
413 | 413 | ||
414 | if (entity == null) | ||
415 | return false; | ||
416 | |||
414 | if (!resultOfObjectLinked) | 417 | if (!resultOfObjectLinked) |
415 | { | 418 | { |
416 | m_numPrim -= grp.PrimCount; | 419 | m_numPrim -= grp.PrimCount; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 68ac178..1abd134 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | 75 | ||
76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
77 | 77 | ||
78 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | ||
79 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); | 78 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); |
80 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); | 79 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); |
81 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); | 80 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); |
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | 136 | ||
138 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; | 137 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; |
139 | 138 | ||
140 | private bool m_startAnimationSet; | ||
141 | |||
142 | //private Vector3 m_requestedSitOffset = new Vector3(); | 139 | //private Vector3 m_requestedSitOffset = new Vector3(); |
143 | 140 | ||
144 | private Vector3 m_LastFinitePos; | 141 | private Vector3 m_LastFinitePos; |
@@ -713,13 +710,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
713 | SetDirectionVectors(); | 710 | SetDirectionVectors(); |
714 | } | 711 | } |
715 | 712 | ||
713 | /* | ||
716 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 714 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
717 | AvatarWearable[] wearables) | 715 | AvatarWearable[] wearables) |
718 | : this(client, world, reginfo) | 716 | : this(client, world, reginfo) |
719 | { | 717 | { |
720 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); | 718 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); |
721 | } | 719 | } |
722 | 720 | */ | |
723 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | 721 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) |
724 | : this(client, world, reginfo) | 722 | : this(client, world, reginfo) |
725 | { | 723 | { |
@@ -733,8 +731,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
733 | 731 | ||
734 | public void RegisterToEvents() | 732 | public void RegisterToEvents() |
735 | { | 733 | { |
736 | m_controllingClient.OnRequestWearables += SendWearables; | ||
737 | m_controllingClient.OnSetAppearance += SetAppearance; | ||
738 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 734 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; |
739 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | 735 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; |
740 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | 736 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; |
@@ -1068,7 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1068 | /// <summary> | 1064 | /// <summary> |
1069 | /// Sets avatar height in the phyiscs plugin | 1065 | /// Sets avatar height in the phyiscs plugin |
1070 | /// </summary> | 1066 | /// </summary> |
1071 | internal void SetHeight(float height) | 1067 | public void SetHeight(float height) |
1072 | { | 1068 | { |
1073 | m_avHeight = height; | 1069 | m_avHeight = height; |
1074 | if (PhysicsActor != null && !IsChildAgent) | 1070 | if (PhysicsActor != null && !IsChildAgent) |
@@ -1133,7 +1129,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1133 | if (friendsModule != null) | 1129 | if (friendsModule != null) |
1134 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1130 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1135 | } | 1131 | } |
1136 | |||
1137 | } | 1132 | } |
1138 | 1133 | ||
1139 | /// <summary> | 1134 | /// <summary> |
@@ -2392,9 +2387,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2392 | if (m_appearance.Texture == null) | 2387 | if (m_appearance.Texture == null) |
2393 | return; | 2388 | return; |
2394 | 2389 | ||
2395 | Vector3 pos = m_pos; | 2390 | if (IsChildAgent) |
2396 | pos.Z += m_appearance.HipOffset; | 2391 | { |
2397 | 2392 | m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data"); | |
2393 | return; | ||
2394 | } | ||
2395 | |||
2398 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); | 2396 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); |
2399 | m_scene.StatsReporter.AddAgentUpdates(1); | 2397 | m_scene.StatsReporter.AddAgentUpdates(1); |
2400 | } | 2398 | } |
@@ -2437,6 +2435,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2437 | m_perfMonMS = Util.EnvironmentTickCount(); | 2435 | m_perfMonMS = Util.EnvironmentTickCount(); |
2438 | 2436 | ||
2439 | // only send update from root agents to other clients; children are only "listening posts" | 2437 | // only send update from root agents to other clients; children are only "listening posts" |
2438 | if (IsChildAgent) | ||
2439 | { | ||
2440 | m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent"); | ||
2441 | return; | ||
2442 | } | ||
2443 | |||
2440 | int count = 0; | 2444 | int count = 0; |
2441 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 2445 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
2442 | { | 2446 | { |
@@ -2460,29 +2464,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2460 | // the inventory arrives | 2464 | // the inventory arrives |
2461 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 2465 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
2462 | 2466 | ||
2463 | Vector3 pos = m_pos; | ||
2464 | pos.Z += m_appearance.HipOffset; | ||
2465 | |||
2466 | m_controllingClient.SendAvatarDataImmediate(this); | 2467 | m_controllingClient.SendAvatarDataImmediate(this); |
2468 | m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); | ||
2467 | 2469 | ||
2468 | SendInitialFullUpdateToAllClients(); | 2470 | SendInitialFullUpdateToAllClients(); |
2469 | } | 2471 | } |
2470 | 2472 | ||
2471 | /// <summary> | 2473 | /// <summary> |
2472 | /// Tell the client for this scene presence what items it should be wearing now | ||
2473 | /// </summary> | ||
2474 | public void SendWearables() | ||
2475 | { | ||
2476 | m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name); | ||
2477 | |||
2478 | ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | ||
2479 | } | ||
2480 | |||
2481 | /// <summary> | ||
2482 | /// | 2474 | /// |
2483 | /// </summary> | 2475 | /// </summary> |
2484 | public void SendAppearanceToAllOtherAgents() | 2476 | public void SendAppearanceToAllOtherAgents() |
2485 | { | 2477 | { |
2478 | // DEBUG ON | ||
2479 | m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid); | ||
2480 | // DEBUG OFF | ||
2486 | m_perfMonMS = Util.EnvironmentTickCount(); | 2481 | m_perfMonMS = Util.EnvironmentTickCount(); |
2487 | 2482 | ||
2488 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2483 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2502,87 +2497,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2502 | /// <param name="avatar"></param> | 2497 | /// <param name="avatar"></param> |
2503 | public void SendAppearanceToOtherAgent(ScenePresence avatar) | 2498 | public void SendAppearanceToOtherAgent(ScenePresence avatar) |
2504 | { | 2499 | { |
2500 | // DEBUG ON | ||
2501 | m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); | ||
2502 | // DEBUG OFF | ||
2505 | avatar.ControllingClient.SendAppearance( | 2503 | avatar.ControllingClient.SendAppearance( |
2506 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2504 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
2507 | } | 2505 | } |
2508 | 2506 | ||
2509 | /// <summary> | ||
2510 | /// Set appearance data (textureentry and slider settings) received from the client | ||
2511 | /// </summary> | ||
2512 | /// <param name="texture"></param> | ||
2513 | /// <param name="visualParam"></param> | ||
2514 | public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
2515 | { | ||
2516 | if (m_physicsActor != null) | ||
2517 | { | ||
2518 | if (!IsChildAgent) | ||
2519 | { | ||
2520 | // This may seem like it's redundant, remove the avatar from the physics scene | ||
2521 | // just to add it back again, but it saves us from having to update | ||
2522 | // 3 variables 10 times a second. | ||
2523 | bool flyingTemp = m_physicsActor.Flying; | ||
2524 | RemoveFromPhysicalScene(); | ||
2525 | //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | ||
2526 | |||
2527 | //PhysicsActor = null; | ||
2528 | |||
2529 | AddToPhysicalScene(flyingTemp); | ||
2530 | } | ||
2531 | } | ||
2532 | |||
2533 | #region Bake Cache Check | ||
2534 | |||
2535 | if (textureEntry != null) | ||
2536 | { | ||
2537 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
2538 | { | ||
2539 | int j = BAKE_INDICES[i]; | ||
2540 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; | ||
2541 | |||
2542 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
2543 | { | ||
2544 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | ||
2545 | { | ||
2546 | m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name); | ||
2547 | this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
2548 | } | ||
2549 | } | ||
2550 | } | ||
2551 | |||
2552 | } | ||
2553 | |||
2554 | |||
2555 | #endregion Bake Cache Check | ||
2556 | |||
2557 | m_appearance.SetAppearance(textureEntry, visualParams); | ||
2558 | if (m_appearance.AvatarHeight > 0) | ||
2559 | SetHeight(m_appearance.AvatarHeight); | ||
2560 | |||
2561 | // This is not needed, because only the transient data changed | ||
2562 | //AvatarData adata = new AvatarData(m_appearance); | ||
2563 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2564 | |||
2565 | SendAppearanceToAllOtherAgents(); | ||
2566 | if (!m_startAnimationSet) | ||
2567 | { | ||
2568 | Animator.UpdateMovementAnimations(); | ||
2569 | m_startAnimationSet = true; | ||
2570 | } | ||
2571 | |||
2572 | Vector3 pos = m_pos; | ||
2573 | pos.Z += m_appearance.HipOffset; | ||
2574 | |||
2575 | m_controllingClient.SendAvatarDataImmediate(this); | ||
2576 | } | ||
2577 | |||
2578 | public void SetWearable(int wearableId, AvatarWearable wearable) | ||
2579 | { | ||
2580 | m_appearance.SetWearable(wearableId, wearable); | ||
2581 | AvatarData adata = new AvatarData(m_appearance); | ||
2582 | m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2583 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | ||
2584 | } | ||
2585 | |||
2586 | // Because appearance setting is in a module, we actually need | 2507 | // Because appearance setting is in a module, we actually need |
2587 | // to give it access to our appearance directly, otherwise we | 2508 | // to give it access to our appearance directly, otherwise we |
2588 | // get a synchronization issue. | 2509 | // get a synchronization issue. |
@@ -3017,6 +2938,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3017 | 2938 | ||
3018 | cAgent.AlwaysRun = m_setAlwaysRun; | 2939 | cAgent.AlwaysRun = m_setAlwaysRun; |
3019 | 2940 | ||
2941 | cAgent.Appearance = new AvatarAppearance(m_appearance); | ||
2942 | |||
2943 | /* | ||
3020 | try | 2944 | try |
3021 | { | 2945 | { |
3022 | // We might not pass the Wearables in all cases... | 2946 | // We might not pass the Wearables in all cases... |
@@ -3056,14 +2980,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3056 | { | 2980 | { |
3057 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | 2981 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); |
3058 | int i = 0; | 2982 | int i = 0; |
3059 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | 2983 | AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count]; |
3060 | foreach (int point in attPoints) | 2984 | foreach (int point in attPoints) |
3061 | { | 2985 | { |
3062 | attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); | 2986 | attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); |
3063 | } | 2987 | } |
3064 | cAgent.Attachments = attachs; | 2988 | cAgent.Attachments = attachs; |
3065 | } | 2989 | } |
3066 | 2990 | */ | |
3067 | lock (scriptedcontrols) | 2991 | lock (scriptedcontrols) |
3068 | { | 2992 | { |
3069 | ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; | 2993 | ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; |
@@ -3090,6 +3014,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3090 | 3014 | ||
3091 | public void CopyFrom(AgentData cAgent) | 3015 | public void CopyFrom(AgentData cAgent) |
3092 | { | 3016 | { |
3017 | // DEBUG ON | ||
3018 | m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM"); | ||
3019 | // DEBUG OFF | ||
3093 | m_originRegionID = cAgent.RegionID; | 3020 | m_originRegionID = cAgent.RegionID; |
3094 | 3021 | ||
3095 | m_callbackURI = cAgent.CallbackURI; | 3022 | m_callbackURI = cAgent.CallbackURI; |
@@ -3115,6 +3042,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3115 | m_godLevel = cAgent.GodLevel; | 3042 | m_godLevel = cAgent.GodLevel; |
3116 | m_setAlwaysRun = cAgent.AlwaysRun; | 3043 | m_setAlwaysRun = cAgent.AlwaysRun; |
3117 | 3044 | ||
3045 | m_appearance = new AvatarAppearance(cAgent.Appearance); | ||
3046 | |||
3047 | /* | ||
3118 | uint i = 0; | 3048 | uint i = 0; |
3119 | try | 3049 | try |
3120 | { | 3050 | { |
@@ -3127,15 +3057,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3127 | UUID assetId = cAgent.Wearables[n + 1]; | 3057 | UUID assetId = cAgent.Wearables[n + 1]; |
3128 | wears[i++] = new AvatarWearable(itemId, assetId); | 3058 | wears[i++] = new AvatarWearable(itemId, assetId); |
3129 | } | 3059 | } |
3130 | m_appearance.Wearables = wears; | 3060 | // m_appearance.Wearables = wears; |
3131 | Primitive.TextureEntry te; | 3061 | Primitive.TextureEntry textures = null; |
3132 | if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) | 3062 | if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) |
3133 | te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); | 3063 | textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); |
3134 | else | 3064 | |
3135 | te = AvatarAppearance.GetDefaultTexture(); | 3065 | byte[] visuals = null; |
3136 | if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) | 3066 | |
3137 | cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); | 3067 | if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) |
3138 | m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); | 3068 | visuals = (byte[])cAgent.VisualParams.Clone(); |
3069 | |||
3070 | m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals); | ||
3139 | } | 3071 | } |
3140 | catch (Exception e) | 3072 | catch (Exception e) |
3141 | { | 3073 | { |
@@ -3148,14 +3080,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3148 | if (cAgent.Attachments != null) | 3080 | if (cAgent.Attachments != null) |
3149 | { | 3081 | { |
3150 | m_appearance.ClearAttachments(); | 3082 | m_appearance.ClearAttachments(); |
3151 | foreach (AttachmentData att in cAgent.Attachments) | 3083 | foreach (AvatarAttachment att in cAgent.Attachments) |
3152 | { | 3084 | { |
3153 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); | 3085 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); |
3154 | } | 3086 | } |
3155 | } | 3087 | } |
3156 | } | 3088 | } |
3157 | catch { } | 3089 | catch { } |
3158 | 3090 | */ | |
3159 | try | 3091 | try |
3160 | { | 3092 | { |
3161 | lock (scriptedcontrols) | 3093 | lock (scriptedcontrols) |
@@ -3724,15 +3656,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3724 | return; | 3656 | return; |
3725 | } | 3657 | } |
3726 | 3658 | ||
3727 | List<int> attPoints = m_appearance.GetAttachedPoints(); | 3659 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); |
3728 | foreach (int p in attPoints) | 3660 | foreach (AvatarAttachment attach in attachments) |
3729 | { | 3661 | { |
3730 | if (m_isDeleted) | 3662 | if (m_isDeleted) |
3731 | return; | 3663 | return; |
3732 | 3664 | ||
3733 | UUID itemID = m_appearance.GetAttachedItem(p); | 3665 | int p = attach.AttachPoint; |
3666 | UUID itemID = attach.ItemID; | ||
3734 | 3667 | ||
3735 | //UUID assetID = m_appearance.GetAttachedAsset(p); | 3668 | //UUID assetID = attach.AssetID; |
3736 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | 3669 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down |
3737 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | 3670 | // But they're not used anyway, the item is being looked up for now, so let's proceed. |
3738 | //if (UUID.Zero == assetID) | 3671 | //if (UUID.Zero == assetID) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 95908fc..e661ca9 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
804 | private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 804 | private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) |
805 | { | 805 | { |
806 | byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); | 806 | byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); |
807 | shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); | 807 | shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); |
808 | } | 808 | } |
809 | 809 | ||
810 | private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) | 810 | private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 159af79..fc17192 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; |
@@ -899,7 +899,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
899 | Scene scene = (Scene)Scene; | 899 | Scene scene = (Scene)Scene; |
900 | AvatarAppearance appearance; | 900 | AvatarAppearance appearance; |
901 | scene.GetAvatarAppearance(this, out appearance); | 901 | scene.GetAvatarAppearance(this, out appearance); |
902 | OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); | 902 | OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone()); |
903 | } | 903 | } |
904 | 904 | ||
905 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 905 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 25dba7f..3d34441 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -220,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
220 | groupID, groupMembers.Count); | 220 | groupID, groupMembers.Count); |
221 | 221 | ||
222 | foreach (GroupMembersData member in groupMembers) | 222 | foreach (GroupMembersData member in groupMembers) |
223 | { | 223 | { |
224 | if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) | 224 | if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) |
225 | { | 225 | { |
226 | // Don't deliver messages to people who have dropped this session | 226 | // Don't deliver messages to people who have dropped this session |
@@ -266,7 +266,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
266 | 266 | ||
267 | void OnClientLogin(IClientAPI client) | 267 | void OnClientLogin(IClientAPI client) |
268 | { | 268 | { |
269 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); | 269 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); |
270 | } | 270 | } |
271 | 271 | ||
272 | private void OnNewClient(IClientAPI client) | 272 | private void OnNewClient(IClientAPI client) |
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 | ||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 33 | namespace 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 2ddc31b..df60709 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | private Scene m_scene; | 52 | private Scene m_scene; |
53 | 53 | ||
54 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); | 54 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); |
55 | 55 | ||
56 | private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>(); | 56 | private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>(); |
@@ -77,7 +77,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
77 | { | 77 | { |
78 | m_log.Info("[MRM] Enabling MRM Module"); | 78 | m_log.Info("[MRM] Enabling MRM Module"); |
79 | m_scene = scene; | 79 | m_scene = scene; |
80 | 80 | ||
81 | // when hidden, we don't listen for client initiated script events | 81 | // when hidden, we don't listen for client initiated script events |
82 | // only making the MRM engine available for region modules | 82 | // only making the MRM engine available for region modules |
83 | if (!source.Configs["MRM"].GetBoolean("Hidden", false)) | 83 | if (!source.Configs["MRM"].GetBoolean("Hidden", false)) |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
85 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | 85 | scene.EventManager.OnRezScript += EventManager_OnRezScript; |
86 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | 86 | scene.EventManager.OnStopScript += EventManager_OnStopScript; |
87 | } | 87 | } |
88 | 88 | ||
89 | scene.EventManager.OnFrame += EventManager_OnFrame; | 89 | scene.EventManager.OnFrame += EventManager_OnFrame; |
90 | 90 | ||
91 | scene.RegisterModuleInterface<IMRMModule>(this); | 91 | scene.RegisterModuleInterface<IMRMModule>(this); |
@@ -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; |
@@ -304,7 +303,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
304 | 303 | ||
305 | public void PostInitialise() | 304 | public void PostInitialise() |
306 | { | 305 | { |
307 | |||
308 | } | 306 | } |
309 | 307 | ||
310 | public void Close() | 308 | public void Close() |
@@ -350,7 +348,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
350 | if (!Directory.Exists(tmp)) | 348 | if (!Directory.Exists(tmp)) |
351 | Directory.CreateDirectory(tmp); | 349 | Directory.CreateDirectory(tmp); |
352 | 350 | ||
353 | |||
354 | m_log.Info("MRM 2"); | 351 | m_log.Info("MRM 2"); |
355 | 352 | ||
356 | try | 353 | try |
@@ -396,8 +393,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
396 | 393 | ||
397 | parameters.IncludeDebugInformation = true; | 394 | parameters.IncludeDebugInformation = true; |
398 | 395 | ||
399 | string rootPath = | 396 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); |
400 | Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | ||
401 | 397 | ||
402 | List<string> libraries = new List<string>(); | 398 | List<string> libraries = new List<string>(); |
403 | string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); | 399 | string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 0786bd9..922eaaf 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -29,6 +29,7 @@ using System.Collections; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Security; | 30 | using System.Security; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | 35 | ||
@@ -81,16 +82,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
81 | get { | 82 | get { |
82 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); | 83 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); |
83 | 84 | ||
84 | Hashtable internalAttachments = GetSP().Appearance.GetAttachments(); | 85 | List<AvatarAttachment> internalAttachments = GetSP().Appearance.GetAttachments(); |
85 | if (internalAttachments != null) | 86 | foreach (AvatarAttachment attach in internalAttachments) |
86 | { | 87 | { |
87 | foreach (DictionaryEntry element in internalAttachments) | 88 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, attach.AttachPoint, |
88 | { | 89 | new UUID(attach.ItemID), |
89 | Hashtable attachInfo = (Hashtable)element.Value; | 90 | new UUID(attach.AssetID), m_security)); |
90 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int) element.Key, | ||
91 | new UUID((string) attachInfo["item"]), | ||
92 | new UUID((string) attachInfo["asset"]), m_security)); | ||
93 | } | ||
94 | } | 91 | } |
95 | 92 | ||
96 | return attachments.ToArray(); | 93 | return attachments.ToArray(); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fae12b6..6928c4e 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); |