diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 160 |
1 files changed, 122 insertions, 38 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ef2125b..3d9c028 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
50 | /// <param name='targetID'></param> | 50 | /// <param name='targetID'></param> |
51 | /// <param name='fromAgent'></param> | 51 | /// <param name='fromAgent'></param> |
52 | /// <param name='broadcast'></param> | 52 | /// <param name='broadcast'></param> |
53 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 53 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
54 | UUID fromID, UUID targetID, bool fromAgent, bool broadcast) | 54 | UUID fromID, UUID targetID, bool fromAgent, bool broadcast) |
55 | { | 55 | { |
56 | OSChatMessage args = new OSChatMessage(); | 56 | OSChatMessage args = new OSChatMessage(); |
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | args.Position = fromPos; | 61 | args.Position = fromPos; |
62 | args.SenderUUID = fromID; | 62 | args.SenderUUID = fromID; |
63 | args.Scene = this; | 63 | args.Scene = this; |
64 | args.Destination = targetID; | ||
64 | 65 | ||
65 | if (fromAgent) | 66 | if (fromAgent) |
66 | { | 67 | { |
@@ -75,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | } | 76 | } |
76 | 77 | ||
77 | args.From = fromName; | 78 | args.From = fromName; |
78 | args.TargetUUID = targetID; | 79 | //args. |
79 | 80 | ||
80 | // m_log.DebugFormat( | 81 | // m_log.DebugFormat( |
81 | // "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}", | 82 | // "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}", |
@@ -86,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
86 | else | 87 | else |
87 | EventManager.TriggerOnChatFromWorld(this, args); | 88 | EventManager.TriggerOnChatFromWorld(this, args); |
88 | } | 89 | } |
89 | 90 | ||
90 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 91 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
91 | UUID fromID, bool fromAgent, bool broadcast) | 92 | UUID fromID, bool fromAgent, bool broadcast) |
92 | { | 93 | { |
@@ -130,19 +131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | { | 131 | { |
131 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); | 132 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); |
132 | } | 133 | } |
133 | /// <summary> | ||
134 | /// | ||
135 | /// </summary> | ||
136 | /// <param name="message"></param> | ||
137 | /// <param name="type"></param> | ||
138 | /// <param name="fromPos"></param> | ||
139 | /// <param name="fromName"></param> | ||
140 | /// <param name="fromAgentID"></param> | ||
141 | /// <param name="targetID"></param> | ||
142 | public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) | ||
143 | { | ||
144 | SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false); | ||
145 | } | ||
146 | 134 | ||
147 | /// <summary> | 135 | /// <summary> |
148 | /// | 136 | /// |
@@ -179,27 +167,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | /// <param name="remoteClient"></param> | 167 | /// <param name="remoteClient"></param> |
180 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 168 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
181 | { | 169 | { |
170 | /* | ||
171 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | ||
172 | |||
173 | if (null == part) | ||
174 | return; | ||
175 | |||
176 | if (part.IsRoot) | ||
177 | { | ||
178 | SceneObjectGroup sog = part.ParentGroup; | ||
179 | sog.SendPropertiesToClient(remoteClient); | ||
180 | |||
181 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | ||
182 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | ||
183 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | ||
184 | { | ||
185 | sog.IsSelected = true; | ||
186 | EventManager.TriggerParcelPrimCountTainted(); | ||
187 | } | ||
188 | } | ||
189 | else | ||
190 | { | ||
191 | part.SendPropertiesToClient(remoteClient); | ||
192 | } | ||
193 | */ | ||
182 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 194 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
183 | 195 | ||
184 | if (null == part) | 196 | if (null == part) |
185 | return; | 197 | return; |
186 | 198 | ||
187 | if (part.IsRoot) | 199 | SceneObjectGroup sog = part.ParentGroup; |
188 | { | 200 | if (sog == null) |
189 | SceneObjectGroup sog = part.ParentGroup; | 201 | return; |
190 | sog.SendPropertiesToClient(remoteClient); | ||
191 | sog.IsSelected = true; | ||
192 | 202 | ||
193 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | 203 | part.SendPropertiesToClient(remoteClient); |
194 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | 204 | |
195 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | 205 | // A prim is only tainted if it's allowed to be edited by the person clicking it. |
196 | { | 206 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) |
197 | EventManager.TriggerParcelPrimCountTainted(); | 207 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) |
198 | } | ||
199 | } | ||
200 | else | ||
201 | { | 208 | { |
202 | part.SendPropertiesToClient(remoteClient); | 209 | part.IsSelected = true; |
210 | EventManager.TriggerParcelPrimCountTainted(); | ||
203 | } | 211 | } |
204 | } | 212 | } |
205 | 213 | ||
@@ -252,7 +260,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 260 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
253 | if (part == null) | 261 | if (part == null) |
254 | return; | 262 | return; |
255 | 263 | /* | |
256 | // A deselect packet contains all the local prims being deselected. However, since selection is still | 264 | // A deselect packet contains all the local prims being deselected. However, since selection is still |
257 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims | 265 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims |
258 | // we end up sending many duplicate ObjectUpdates | 266 | // we end up sending many duplicate ObjectUpdates |
@@ -263,7 +271,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
263 | // handled by group, but by prim. Legacy cruft. | 271 | // handled by group, but by prim. Legacy cruft. |
264 | // TODO: Make selection flagging per prim! | 272 | // TODO: Make selection flagging per prim! |
265 | // | 273 | // |
266 | part.ParentGroup.IsSelected = false; | 274 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) |
275 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
276 | part.ParentGroup.IsSelected = false; | ||
267 | 277 | ||
268 | part.ParentGroup.ScheduleGroupForFullUpdate(); | 278 | part.ParentGroup.ScheduleGroupForFullUpdate(); |
269 | 279 | ||
@@ -280,6 +290,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | part.UUID, remoteClient.AgentId)) | 290 | part.UUID, remoteClient.AgentId)) |
281 | EventManager.TriggerParcelPrimCountTainted(); | 291 | EventManager.TriggerParcelPrimCountTainted(); |
282 | } | 292 | } |
293 | */ | ||
294 | |||
295 | bool oldgprSelect = part.ParentGroup.IsSelected; | ||
296 | |||
297 | // This is wrong, wrong, wrong. Selection should not be | ||
298 | // handled by group, but by prim. Legacy cruft. | ||
299 | // TODO: Make selection flagging per prim! | ||
300 | // | ||
301 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) | ||
302 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
303 | { | ||
304 | part.IsSelected = false; | ||
305 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) | ||
306 | EventManager.TriggerParcelPrimCountTainted(); | ||
307 | } | ||
308 | |||
309 | // restore targetOmega | ||
310 | if (part.AngularVelocity != Vector3.Zero) | ||
311 | part.ScheduleTerseUpdate(); | ||
312 | |||
283 | } | 313 | } |
284 | 314 | ||
285 | public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount, | 315 | public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount, |
@@ -434,12 +464,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | } | 464 | } |
435 | }); | 465 | }); |
436 | } | 466 | } |
437 | 467 | ||
438 | private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other) | 468 | private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other) |
439 | { | 469 | { |
440 | return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10; | 470 | return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10; |
441 | } | 471 | } |
442 | 472 | ||
473 | private class DescendentsRequestData | ||
474 | { | ||
475 | public IClientAPI RemoteClient; | ||
476 | public UUID FolderID; | ||
477 | public UUID OwnerID; | ||
478 | public bool FetchFolders; | ||
479 | public bool FetchItems; | ||
480 | public int SortOrder; | ||
481 | } | ||
482 | |||
483 | private Queue<DescendentsRequestData> m_descendentsRequestQueue = new Queue<DescendentsRequestData>(); | ||
484 | private Object m_descendentsRequestLock = new Object(); | ||
485 | private bool m_descendentsRequestProcessing = false; | ||
486 | |||
443 | /// <summary> | 487 | /// <summary> |
444 | /// Tell the client about the various child items and folders contained in the requested folder. | 488 | /// Tell the client about the various child items and folders contained in the requested folder. |
445 | /// </summary> | 489 | /// </summary> |
@@ -476,17 +520,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
476 | } | 520 | } |
477 | } | 521 | } |
478 | 522 | ||
479 | // We're going to send the reply async, because there may be | 523 | lock (m_descendentsRequestLock) |
480 | // an enormous quantity of packets -- basically the entire inventory! | 524 | { |
481 | // We don't want to block the client thread while all that is happening. | 525 | if (!m_descendentsRequestProcessing) |
482 | SendInventoryDelegate d = SendInventoryAsync; | 526 | { |
483 | d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d); | 527 | m_descendentsRequestProcessing = true; |
528 | |||
529 | // We're going to send the reply async, because there may be | ||
530 | // an enormous quantity of packets -- basically the entire inventory! | ||
531 | // We don't want to block the client thread while all that is happening. | ||
532 | SendInventoryDelegate d = SendInventoryAsync; | ||
533 | d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d); | ||
534 | |||
535 | return; | ||
536 | } | ||
537 | |||
538 | DescendentsRequestData req = new DescendentsRequestData(); | ||
539 | req.RemoteClient = remoteClient; | ||
540 | req.FolderID = folderID; | ||
541 | req.OwnerID = ownerID; | ||
542 | req.FetchFolders = fetchFolders; | ||
543 | req.FetchItems = fetchItems; | ||
544 | req.SortOrder = sortOrder; | ||
545 | |||
546 | m_descendentsRequestQueue.Enqueue(req); | ||
547 | } | ||
484 | } | 548 | } |
485 | 549 | ||
486 | delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | 550 | delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); |
487 | 551 | ||
488 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 552 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) |
489 | { | 553 | { |
554 | <<<<<<< HEAD | ||
490 | try | 555 | try |
491 | { | 556 | { |
492 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | 557 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); |
@@ -497,12 +562,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
497 | string.Format( | 562 | string.Format( |
498 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); | 563 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); |
499 | } | 564 | } |
565 | ======= | ||
566 | Thread.Sleep(20); | ||
567 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | ||
568 | >>>>>>> avn/ubitvar | ||
500 | } | 569 | } |
501 | 570 | ||
502 | void SendInventoryComplete(IAsyncResult iar) | 571 | void SendInventoryComplete(IAsyncResult iar) |
503 | { | 572 | { |
504 | SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; | 573 | SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; |
505 | d.EndInvoke(iar); | 574 | d.EndInvoke(iar); |
575 | |||
576 | lock (m_descendentsRequestLock) | ||
577 | { | ||
578 | if (m_descendentsRequestQueue.Count > 0) | ||
579 | { | ||
580 | DescendentsRequestData req = m_descendentsRequestQueue.Dequeue(); | ||
581 | |||
582 | d = SendInventoryAsync; | ||
583 | d.BeginInvoke(req.RemoteClient, req.FolderID, req.OwnerID, req.FetchFolders, req.FetchItems, req.SortOrder, SendInventoryComplete, d); | ||
584 | |||
585 | return; | ||
586 | } | ||
587 | |||
588 | m_descendentsRequestProcessing = false; | ||
589 | } | ||
506 | } | 590 | } |
507 | 591 | ||
508 | /// <summary> | 592 | /// <summary> |