diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 99 |
1 files changed, 64 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index db4ab52..ad12420 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -114,8 +114,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
114 | private static readonly Vector3 m_sitTargetCorrectionOffset = new Vector3(0.1f, 0.0f, 0.3f); | 114 | private static readonly Vector3 m_sitTargetCorrectionOffset = new Vector3(0.1f, 0.0f, 0.3f); |
115 | private float m_godlevel = 0; | 115 | private float m_godlevel = 0; |
116 | 116 | ||
117 | private bool m_attachmentsTransported = true; | ||
118 | |||
119 | private bool m_invulnerable = true; | 117 | private bool m_invulnerable = true; |
120 | 118 | ||
121 | private Vector3 m_LastChildAgentUpdatePosition = new Vector3(); | 119 | private Vector3 m_LastChildAgentUpdatePosition = new Vector3(); |
@@ -611,8 +609,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
611 | } | 609 | } |
612 | 610 | ||
613 | foreach (EntityBase e in ents) | 611 | foreach (EntityBase e in ents) |
612 | { | ||
614 | if (e is SceneObjectGroup) | 613 | if (e is SceneObjectGroup) |
615 | m_pendingObjects.Enqueue((SceneObjectGroup)e); | 614 | m_pendingObjects.Enqueue((SceneObjectGroup)e); |
615 | } | ||
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
@@ -626,7 +626,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
626 | // So it's not implemented now. | 626 | // So it's not implemented now. |
627 | // | 627 | // |
628 | 628 | ||
629 | // Don't even queue if we have seent this one | 629 | // Don't even queue if we have sent this one |
630 | // | 630 | // |
631 | if (!m_updateTimes.ContainsKey(g.UUID)) | 631 | if (!m_updateTimes.ContainsKey(g.UUID)) |
632 | g.ScheduleFullUpdateToAvatar(this); | 632 | g.ScheduleFullUpdateToAvatar(this); |
@@ -637,6 +637,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
637 | while (m_partsUpdateQueue.Count > 0) | 637 | while (m_partsUpdateQueue.Count > 0) |
638 | { | 638 | { |
639 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); | 639 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); |
640 | if (part.ParentGroup == null || part.ParentGroup.RootPart == null) | ||
641 | continue; | ||
640 | if (m_updateTimes.ContainsKey(part.UUID)) | 642 | if (m_updateTimes.ContainsKey(part.UUID)) |
641 | { | 643 | { |
642 | ScenePartUpdate update = m_updateTimes[part.UUID]; | 644 | ScenePartUpdate update = m_updateTimes[part.UUID]; |
@@ -680,12 +682,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
680 | { | 682 | { |
681 | //never been sent to client before so do full update | 683 | //never been sent to client before so do full update |
682 | 684 | ||
683 | part.SendFullUpdate(ControllingClient, | 685 | |
684 | GenerateClientFlags(part.UUID)); | 686 | // Attachment handling |
687 | // | ||
688 | if (part.ParentGroup.RootPart.Shape.PCode == 9 && part.ParentGroup.RootPart.Shape.State != 0) | ||
689 | { | ||
690 | if (part != part.ParentGroup.RootPart) | ||
691 | continue; | ||
692 | |||
693 | part.ParentGroup.SendFullUpdateToClient(ControllingClient); | ||
694 | continue; | ||
695 | } | ||
696 | |||
685 | ScenePartUpdate update = new ScenePartUpdate(); | 697 | ScenePartUpdate update = new ScenePartUpdate(); |
686 | update.FullID = part.UUID; | 698 | update.FullID = part.UUID; |
687 | update.LastFullUpdateTime = part.TimeStampFull; | 699 | update.LastFullUpdateTime = part.TimeStampFull; |
688 | m_updateTimes.Add(part.UUID, update); | 700 | m_updateTimes.Add(part.UUID, update); |
701 | |||
702 | part.SendFullUpdate(ControllingClient, | ||
703 | GenerateClientFlags(part.UUID)); | ||
689 | updateCount++; | 704 | updateCount++; |
690 | } | 705 | } |
691 | 706 | ||
@@ -1115,7 +1130,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1115 | // { | 1130 | // { |
1116 | proxyObjectGroup.SendGroupFullUpdate(); | 1131 | proxyObjectGroup.SendGroupFullUpdate(); |
1117 | remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false); | 1132 | remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false); |
1118 | m_scene.DeleteSceneObject(proxyObjectGroup); | 1133 | m_scene.DeleteSceneObject(proxyObjectGroup, false); |
1119 | // } | 1134 | // } |
1120 | // else | 1135 | // else |
1121 | // { | 1136 | // { |
@@ -2206,9 +2221,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2206 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 2221 | // now we have a child agent in this region. Request all interesting data about other (root) agents |
2207 | SendInitialFullUpdateToAllClients(); | 2222 | SendInitialFullUpdateToAllClients(); |
2208 | 2223 | ||
2209 | CrossAttachmentsIntoNewRegion(neighbourHandle); | 2224 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
2210 | 2225 | ||
2211 | m_scene.SendKillObject(m_localId); | 2226 | // m_scene.SendKillObject(m_localId); |
2212 | 2227 | ||
2213 | m_scene.NotifyMyCoarseLocationChange(); | 2228 | m_scene.NotifyMyCoarseLocationChange(); |
2214 | // the user may change their profile information in other region, | 2229 | // the user may change their profile information in other region, |
@@ -2473,22 +2488,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
2473 | { | 2488 | { |
2474 | lock (m_attachments) | 2489 | lock (m_attachments) |
2475 | { | 2490 | { |
2476 | if (!m_attachmentsTransported) | 2491 | try |
2477 | { | 2492 | { |
2478 | try | 2493 | foreach (SceneObjectGroup grp in m_attachments) |
2479 | { | ||
2480 | foreach (SceneObjectGroup grp in m_attachments) | ||
2481 | { | ||
2482 | // ControllingClient may be null at this point! | ||
2483 | m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient); | ||
2484 | } | ||
2485 | } | ||
2486 | catch (InvalidOperationException) | ||
2487 | { | 2494 | { |
2488 | m_log.Info("[CLIENT]: Couldn't save attachments. :("); | 2495 | // ControllingClient may be null at this point! |
2496 | m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient); | ||
2489 | } | 2497 | } |
2490 | m_attachments.Clear(); | ||
2491 | } | 2498 | } |
2499 | catch (InvalidOperationException) | ||
2500 | { | ||
2501 | m_log.Info("[CLIENT]: Couldn't save attachments. :("); | ||
2502 | } | ||
2503 | m_attachments.Clear(); | ||
2492 | } | 2504 | } |
2493 | lock (m_knownChildRegions) | 2505 | lock (m_knownChildRegions) |
2494 | { | 2506 | { |
@@ -2582,9 +2594,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2582 | return true; | 2594 | return true; |
2583 | } | 2595 | } |
2584 | 2596 | ||
2585 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle) | 2597 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) |
2586 | { | 2598 | { |
2587 | m_attachmentsTransported = true; | ||
2588 | lock (m_attachments) | 2599 | lock (m_attachments) |
2589 | { | 2600 | { |
2590 | // Validate | 2601 | // Validate |
@@ -2604,7 +2615,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2604 | gobj.RootPart.IsAttachment = false; | 2615 | gobj.RootPart.IsAttachment = false; |
2605 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; | 2616 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; |
2606 | gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | 2617 | gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); |
2607 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); | 2618 | m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); |
2619 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); | ||
2608 | } | 2620 | } |
2609 | } | 2621 | } |
2610 | m_attachments.Clear(); | 2622 | m_attachments.Clear(); |
@@ -3130,6 +3142,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
3130 | 3142 | ||
3131 | private void ItemReceived(UUID itemID) | 3143 | private void ItemReceived(UUID itemID) |
3132 | { | 3144 | { |
3145 | if (IsChildAgent) | ||
3146 | return; | ||
3147 | |||
3133 | if (null == m_appearance) | 3148 | if (null == m_appearance) |
3134 | { | 3149 | { |
3135 | m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); | 3150 | m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); |
@@ -3143,14 +3158,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
3143 | UUID asset = m_appearance.GetAttachedAsset(attachpoint); | 3158 | UUID asset = m_appearance.GetAttachedAsset(attachpoint); |
3144 | if (UUID.Zero == asset) // We have just logged in | 3159 | if (UUID.Zero == asset) // We have just logged in |
3145 | { | 3160 | { |
3146 | m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}", | ||
3147 | itemID.ToString()); | ||
3148 | |||
3149 | try | 3161 | try |
3150 | { | 3162 | { |
3151 | // Rez from inventory | 3163 | // Rez from inventory |
3152 | m_scene.RezSingleAttachment(ControllingClient, itemID, | 3164 | asset = m_scene.RezSingleAttachment(ControllingClient, |
3153 | (uint)attachpoint); | 3165 | itemID, (uint)attachpoint); |
3166 | // Corner case: We are not yet a Scene Entity | ||
3167 | // Setting attachment info in RezSingleAttachment will fail | ||
3168 | // Set it here | ||
3169 | // | ||
3170 | m_appearance.SetAttachment((int)attachpoint, itemID, | ||
3171 | asset); | ||
3172 | m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}", | ||
3173 | itemID.ToString(), asset); | ||
3174 | |||
3154 | } | 3175 | } |
3155 | catch (Exception e) | 3176 | catch (Exception e) |
3156 | { | 3177 | { |
@@ -3160,20 +3181,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
3160 | return; | 3181 | return; |
3161 | } | 3182 | } |
3162 | 3183 | ||
3163 | SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); | 3184 | SceneObjectPart att = m_scene.GetSceneObjectPart(asset); |
3164 | 3185 | ||
3165 | 3186 | ||
3166 | // If this is null, then the asset has not yet appeared in world | 3187 | // If this is null, then the asset has not yet appeared in world |
3167 | // so we revisit this when it does | 3188 | // so we revisit this when it does |
3168 | // | 3189 | // |
3169 | if (att != null) | 3190 | if (att != null && att.UUID != asset) // Yes. It's really needed |
3170 | { | 3191 | { |
3171 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", | 3192 | m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); |
3172 | itemID.ToString()); | ||
3173 | 3193 | ||
3174 | // Attach from world, if not already attached | 3194 | // This will throw if crossing katty-korner |
3175 | if (att.ParentGroup != null && !att.IsAttachment) | 3195 | // So catch it here to avoid the noid |
3176 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero); | 3196 | // |
3197 | try | ||
3198 | { | ||
3199 | // Attach from world, if not already attached | ||
3200 | if (att.ParentGroup != null && !att.IsAttachment) | ||
3201 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero); | ||
3202 | } | ||
3203 | catch (System.NullReferenceException e) | ||
3204 | { | ||
3205 | } | ||
3177 | } | 3206 | } |
3178 | } | 3207 | } |
3179 | } | 3208 | } |