diff options
author | Diva Canto | 2009-08-16 16:17:19 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-16 16:17:19 -0700 |
commit | e02062051d38e56ec22952e25a558039b5e54ab3 (patch) | |
tree | 5736388c72743843fd208cc30c5785898dd7b906 /OpenSim | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim into in... (diff) | |
download | opensim-SC-e02062051d38e56ec22952e25a558039b5e54ab3.zip opensim-SC-e02062051d38e56ec22952e25a558039b5e54ab3.tar.gz opensim-SC-e02062051d38e56ec22952e25a558039b5e54ab3.tar.bz2 opensim-SC-e02062051d38e56ec22952e25a558039b5e54ab3.tar.xz |
Making attachments work again. Tons of debug more. This needs more testing and a lot of cleaning.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 64 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 151 |
8 files changed, 184 insertions, 67 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 6472f31..c0168e2 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -215,6 +215,7 @@ namespace OpenSim.Framework | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | |||
218 | /// <summary> | 219 | /// <summary> |
219 | /// Serializable Agent Circuit Data | 220 | /// Serializable Agent Circuit Data |
220 | /// </summary> | 221 | /// </summary> |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index aacd127..825ab81 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -226,6 +226,46 @@ namespace OpenSim.Framework | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | public class AttachmentData | ||
230 | { | ||
231 | public int AttachPoint; | ||
232 | public UUID ItemID; | ||
233 | public UUID AssetID; | ||
234 | |||
235 | public AttachmentData(int point, UUID item, UUID asset) | ||
236 | { | ||
237 | AttachPoint = point; | ||
238 | ItemID = item; | ||
239 | AssetID = asset; | ||
240 | } | ||
241 | |||
242 | public AttachmentData(OSDMap args) | ||
243 | { | ||
244 | UnpackUpdateMessage(args); | ||
245 | } | ||
246 | |||
247 | public OSDMap PackUpdateMessage() | ||
248 | { | ||
249 | OSDMap attachdata = new OSDMap(); | ||
250 | attachdata["point"] = OSD.FromInteger(AttachPoint); | ||
251 | attachdata["item"] = OSD.FromUUID(ItemID); | ||
252 | attachdata["asset"] = OSD.FromUUID(AssetID); | ||
253 | |||
254 | return attachdata; | ||
255 | } | ||
256 | |||
257 | |||
258 | public void UnpackUpdateMessage(OSDMap args) | ||
259 | { | ||
260 | if (args["point"] != null) | ||
261 | AttachPoint = args["point"].AsInteger(); | ||
262 | if (args["item"] != null) | ||
263 | ItemID = args["item"].AsUUID(); | ||
264 | if (args["asset"] != null) | ||
265 | AssetID = args["asset"].AsUUID(); | ||
266 | } | ||
267 | } | ||
268 | |||
229 | public class AgentData : IAgentData | 269 | public class AgentData : IAgentData |
230 | { | 270 | { |
231 | private UUID m_id; | 271 | private UUID m_id; |
@@ -272,6 +312,7 @@ namespace OpenSim.Framework | |||
272 | public byte[] AgentTextures; | 312 | public byte[] AgentTextures; |
273 | public byte[] VisualParams; | 313 | public byte[] VisualParams; |
274 | public UUID[] Wearables; | 314 | public UUID[] Wearables; |
315 | public AttachmentData[] Attachments; | ||
275 | 316 | ||
276 | public string CallbackURI; | 317 | public string CallbackURI; |
277 | 318 | ||
@@ -352,6 +393,13 @@ namespace OpenSim.Framework | |||
352 | args["wearables"] = wears; | 393 | args["wearables"] = wears; |
353 | } | 394 | } |
354 | 395 | ||
396 | if ((Attachments != null) && (Attachments.Length > 0)) | ||
397 | { | ||
398 | OSDArray attachs = new OSDArray(Attachments.Length); | ||
399 | foreach (AttachmentData att in Attachments) | ||
400 | attachs.Add(att.PackUpdateMessage()); | ||
401 | args["attachments"] = attachs; | ||
402 | } | ||
355 | 403 | ||
356 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) | 404 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) |
357 | args["callback_uri"] = OSD.FromString(CallbackURI); | 405 | args["callback_uri"] = OSD.FromString(CallbackURI); |
@@ -492,7 +540,21 @@ namespace OpenSim.Framework | |||
492 | foreach (OSD o in wears) | 540 | foreach (OSD o in wears) |
493 | Wearables[i++] = o.AsUUID(); | 541 | Wearables[i++] = o.AsUUID(); |
494 | } | 542 | } |
495 | 543 | ||
544 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | ||
545 | { | ||
546 | OSDArray attachs = (OSDArray)(args["attachments"]); | ||
547 | Attachments = new AttachmentData[attachs.Count]; | ||
548 | int i = 0; | ||
549 | foreach (OSD o in attachs) | ||
550 | { | ||
551 | if (o.Type == OSDType.Map) | ||
552 | { | ||
553 | Attachments[i++] = new AttachmentData((OSDMap)o); | ||
554 | } | ||
555 | } | ||
556 | } | ||
557 | |||
496 | if (args["callback_uri"] != null) | 558 | if (args["callback_uri"] != null) |
497 | CallbackURI = args["callback_uri"].AsString(); | 559 | CallbackURI = args["callback_uri"].AsString(); |
498 | } | 560 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 59b2019..dd451ef 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -274,9 +274,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
274 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | 274 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) |
275 | folders[(AssetType)folder.Type] = folder; | 275 | folders[(AssetType)folder.Type] = folder; |
276 | } | 276 | } |
277 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | ||
278 | // Put the root folder there, as type Folder | 277 | // Put the root folder there, as type Folder |
279 | folders[AssetType.Folder] = root; | 278 | folders[AssetType.Folder] = root; |
279 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | ||
280 | return folders; | 280 | return folders; |
281 | } | 281 | } |
282 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); | 282 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cea9044..f5e9be1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2357,7 +2357,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2357 | ScenePresence presence; | 2357 | ScenePresence presence; |
2358 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | 2358 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
2359 | { | 2359 | { |
2360 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.UUID); | 2360 | // XXYY!! |
2361 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); | ||
2362 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
2361 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); | 2363 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); |
2362 | if (ava != null) | 2364 | if (ava != null) |
2363 | { | 2365 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 33166df..f475c64 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2042,13 +2042,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2042 | } | 2042 | } |
2043 | else | 2043 | else |
2044 | { | 2044 | { |
2045 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | ||
2046 | |||
2045 | m_log.DebugFormat( | 2047 | m_log.DebugFormat( |
2046 | "[SCENE]: Adding new child agent for {0} in {1}", | 2048 | "[SCENE]: Adding new {0} agent for {1} in {2}", |
2047 | client.Name, RegionInfo.RegionName); | 2049 | ((aCircuit.child == true) ? "child" : "root"), client.Name, RegionInfo.RegionName); |
2048 | 2050 | ||
2049 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 2051 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
2050 | 2052 | ||
2051 | CreateAndAddScenePresence(client); | 2053 | ScenePresence sp = CreateAndAddScenePresence(client); |
2054 | |||
2055 | // HERE!!! Do the initial attachments here | ||
2056 | if (aCircuit.child == false) // first agent upon login is root agent | ||
2057 | { | ||
2058 | sp.IsChildAgent = false; | ||
2059 | sp.RezAttachments(); | ||
2060 | } | ||
2052 | } | 2061 | } |
2053 | 2062 | ||
2054 | m_LastLogin = Environment.TickCount; | 2063 | m_LastLogin = Environment.TickCount; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3bd079a..fd13633 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -557,6 +557,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
557 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | 557 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); |
558 | if (group != null) | 558 | if (group != null) |
559 | { | 559 | { |
560 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject got {0}", group.UUID); | ||
560 | if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | 561 | if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) |
561 | { | 562 | { |
562 | // If the attachment point isn't the same as the one previously used | 563 | // If the attachment point isn't the same as the one previously used |
@@ -564,6 +565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
564 | // and not in a weird location somewhere unknown. | 565 | // and not in a weird location somewhere unknown. |
565 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | 566 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) |
566 | { | 567 | { |
568 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 1 got {0}", group.UUID); | ||
567 | attachPos = Vector3.Zero; | 569 | attachPos = Vector3.Zero; |
568 | } | 570 | } |
569 | 571 | ||
@@ -572,7 +574,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
572 | { | 574 | { |
573 | // Check object for stored attachment point | 575 | // Check object for stored attachment point |
574 | AttachmentPt = (uint)group.GetAttachmentPoint(); | 576 | AttachmentPt = (uint)group.GetAttachmentPoint(); |
575 | } | 577 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 2 got {0}", group.UUID); |
578 | } | ||
576 | 579 | ||
577 | // if we still didn't find a suitable attachment point....... | 580 | // if we still didn't find a suitable attachment point....... |
578 | if (AttachmentPt == 0) | 581 | if (AttachmentPt == 0) |
@@ -580,8 +583,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | // Stick it on left hand with Zero Offset from the attachment point. | 583 | // Stick it on left hand with Zero Offset from the attachment point. |
581 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | 584 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
582 | attachPos = Vector3.Zero; | 585 | attachPos = Vector3.Zero; |
586 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 3 got {0}", group.UUID); | ||
587 | |||
583 | } | 588 | } |
584 | 589 | ||
590 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 4 got {0}", group.UUID); | ||
591 | |||
585 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); | 592 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); |
586 | group.AbsolutePosition = attachPos; | 593 | group.AbsolutePosition = attachPos; |
587 | 594 | ||
@@ -590,10 +597,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
590 | 597 | ||
591 | if (group.GetFromItemID() == UUID.Zero) | 598 | if (group.GetFromItemID() == UUID.Zero) |
592 | { | 599 | { |
600 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 5 got {0}", group.UUID); | ||
593 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | 601 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); |
594 | } | 602 | } |
595 | else | 603 | else |
596 | { | 604 | { |
605 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject 6 got {0}", group.GetFromItemID()); | ||
597 | itemId = group.GetFromItemID(); | 606 | itemId = group.GetFromItemID(); |
598 | } | 607 | } |
599 | 608 | ||
@@ -611,6 +620,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); | 620 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); |
612 | } | 621 | } |
613 | } | 622 | } |
623 | else | ||
624 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); | ||
614 | } | 625 | } |
615 | 626 | ||
616 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 627 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 708c455..1b541c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -935,6 +935,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
935 | SetAttachmentPoint(Convert.ToByte(attachmentpoint)); | 935 | SetAttachmentPoint(Convert.ToByte(attachmentpoint)); |
936 | 936 | ||
937 | avatar.AddAttachment(this); | 937 | avatar.AddAttachment(this); |
938 | m_log.DebugFormat("[SOG]: Added att {0} to avie {1}", UUID, avatar.UUID); | ||
938 | 939 | ||
939 | if (!silent) | 940 | if (!silent) |
940 | { | 941 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fc8b62e..b0bb005 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -652,9 +652,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
652 | RegisterToEvents(); | 652 | RegisterToEvents(); |
653 | SetDirectionVectors(); | 653 | SetDirectionVectors(); |
654 | 654 | ||
655 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); | ||
656 | if (userInfo != null) | ||
657 | userInfo.OnItemReceived += ItemReceived; | ||
658 | } | 655 | } |
659 | 656 | ||
660 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 657 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
@@ -1021,7 +1018,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | } | 1018 | } |
1022 | 1019 | ||
1023 | /// <summary> | 1020 | /// <summary> |
1024 | /// Complete Avatar's movement into the region | 1021 | /// Complete Avatar's movement into the region. |
1022 | /// This is called upon a very important packet sent from the client, | ||
1023 | /// so it's client-controlled. Never call this method directly. | ||
1025 | /// </summary> | 1024 | /// </summary> |
1026 | public void CompleteMovement() | 1025 | public void CompleteMovement() |
1027 | { | 1026 | { |
@@ -1042,22 +1041,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1042 | AbsolutePosition = pos; | 1041 | AbsolutePosition = pos; |
1043 | } | 1042 | } |
1044 | 1043 | ||
1045 | if (m_isChildAgent) | 1044 | m_isChildAgent = false; |
1046 | { | 1045 | bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1047 | m_isChildAgent = false; | 1046 | MakeRootAgent(AbsolutePosition, m_flying); |
1048 | bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
1049 | MakeRootAgent(AbsolutePosition, m_flying); | ||
1050 | |||
1051 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | ||
1052 | { | ||
1053 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | ||
1054 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | ||
1055 | m_callbackURI = null; | ||
1056 | } | ||
1057 | 1047 | ||
1058 | //m_log.DebugFormat("Completed movement"); | 1048 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1049 | { | ||
1050 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | ||
1051 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | ||
1052 | m_callbackURI = null; | ||
1059 | } | 1053 | } |
1060 | 1054 | ||
1055 | //m_log.DebugFormat("Completed movement"); | ||
1056 | |||
1061 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1057 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1062 | SendInitialData(); | 1058 | SendInitialData(); |
1063 | 1059 | ||
@@ -3154,6 +3150,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3154 | m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); | 3150 | m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); |
3155 | } | 3151 | } |
3156 | 3152 | ||
3153 | //Attachments | ||
3154 | List<int> attPoints = m_appearance.GetAttachedPoints(); | ||
3155 | if (attPoints != null) | ||
3156 | { | ||
3157 | m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | ||
3158 | int i = 0; | ||
3159 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | ||
3160 | foreach (int point in attPoints) | ||
3161 | { | ||
3162 | attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); | ||
3163 | } | ||
3164 | cAgent.Attachments = attachs; | ||
3165 | } | ||
3166 | |||
3157 | // Animations | 3167 | // Animations |
3158 | try | 3168 | try |
3159 | { | 3169 | { |
@@ -3219,6 +3229,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3219 | m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); | 3229 | m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); |
3220 | } | 3230 | } |
3221 | 3231 | ||
3232 | // Attachments | ||
3233 | try | ||
3234 | { | ||
3235 | if (cAgent.Attachments != null) | ||
3236 | { | ||
3237 | foreach (AttachmentData att in cAgent.Attachments) | ||
3238 | { | ||
3239 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); | ||
3240 | } | ||
3241 | } | ||
3242 | } | ||
3243 | catch { } | ||
3244 | |||
3222 | // Animations | 3245 | // Animations |
3223 | try | 3246 | try |
3224 | { | 3247 | { |
@@ -3729,37 +3752,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
3729 | return flags; | 3752 | return flags; |
3730 | } | 3753 | } |
3731 | 3754 | ||
3732 | private void ItemReceived(UUID itemID) | 3755 | /// <summary> |
3756 | /// RezAttachments. This should only be called upon login on the first region | ||
3757 | /// </summary> | ||
3758 | public void RezAttachments() | ||
3733 | { | 3759 | { |
3734 | if (IsChildAgent) | ||
3735 | return; | ||
3736 | |||
3737 | if (null == m_appearance) | 3760 | if (null == m_appearance) |
3738 | { | 3761 | { |
3739 | m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); | 3762 | m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); |
3740 | return; | 3763 | return; |
3741 | } | 3764 | } |
3742 | 3765 | ||
3743 | int attachpoint = m_appearance.GetAttachpoint(itemID); | 3766 | List<int> attPoints = m_appearance.GetAttachedPoints(); |
3744 | if (attachpoint == 0) | 3767 | foreach (int p in attPoints) |
3745 | return; | ||
3746 | |||
3747 | UUID asset = m_appearance.GetAttachedAsset(attachpoint); | ||
3748 | if (UUID.Zero == asset) // We have just logged in | ||
3749 | { | 3768 | { |
3769 | UUID itemID = m_appearance.GetAttachedItem(p); | ||
3770 | UUID assetID = m_appearance.GetAttachedAsset(p); | ||
3771 | |||
3772 | if (UUID.Zero == assetID) | ||
3773 | { | ||
3774 | m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); | ||
3775 | continue; | ||
3776 | } | ||
3777 | |||
3750 | try | 3778 | try |
3751 | { | 3779 | { |
3752 | // Rez from inventory | 3780 | // Rez from inventory |
3753 | asset = m_scene.RezSingleAttachment(ControllingClient, | 3781 | UUID asset = m_scene.RezSingleAttachment(ControllingClient, |
3754 | itemID, (uint)attachpoint); | 3782 | itemID, (uint)p); |
3755 | // Corner case: We are not yet a Scene Entity | 3783 | |
3756 | // Setting attachment info in RezSingleAttachment will fail | 3784 | m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", |
3757 | // Set it here | 3785 | p, itemID, assetID, asset); |
3758 | // | 3786 | |
3759 | m_appearance.SetAttachment((int)attachpoint, itemID, | 3787 | //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); |
3760 | asset); | 3788 | //m_log.DebugFormat("[ATTCHMENT]: Got scene object parent {0} IsAtt {1}", |
3761 | m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}", | 3789 | // ((att.ParentGroup != null) ? "not null" : "null"), att.IsAttachment); |
3762 | itemID.ToString(), asset); | 3790 | //if (att.ParentGroup != null && !att.IsAttachment) |
3791 | //{ | ||
3792 | // att.FromItemID = itemID; | ||
3793 | // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); | ||
3794 | //} | ||
3763 | 3795 | ||
3764 | } | 3796 | } |
3765 | catch (Exception e) | 3797 | catch (Exception e) |
@@ -3767,31 +3799,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3767 | m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); | 3799 | m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); |
3768 | } | 3800 | } |
3769 | 3801 | ||
3770 | return; | ||
3771 | } | 3802 | } |
3772 | 3803 | ||
3773 | SceneObjectPart att = m_scene.GetSceneObjectPart(asset); | 3804 | //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); |
3774 | 3805 | ||
3775 | // If this is null, then the asset has not yet appeared in world | 3806 | //// If this is null, then the asset has not yet appeared in world |
3776 | // so we revisit this when it does | 3807 | //// so we revisit this when it does |
3777 | // | 3808 | //// |
3778 | if (att != null && att.UUID != asset) // Yes. It's really needed | 3809 | //if (att != null && att.UUID != asset) // Yes. It's really needed |
3779 | { | 3810 | //{ |
3780 | m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); | 3811 | // m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); |
3781 | 3812 | ||
3782 | // This will throw if crossing katty-korner | 3813 | // // This will throw if crossing katty-korner |
3783 | // So catch it here to avoid the noid | 3814 | // // So catch it here to avoid the noid |
3784 | // | 3815 | // // |
3785 | try | 3816 | // try |
3786 | { | 3817 | // { |
3787 | // Attach from world, if not already attached | 3818 | // // Attach from world, if not already attached |
3788 | if (att.ParentGroup != null && !att.IsAttachment) | 3819 | // if (att.ParentGroup != null && !att.IsAttachment) |
3789 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); | 3820 | // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); |
3790 | } | 3821 | // } |
3791 | catch (NullReferenceException) | 3822 | // catch (NullReferenceException) |
3792 | { | 3823 | // { |
3793 | } | 3824 | // } |
3794 | } | 3825 | //} |
3795 | } | 3826 | } |
3796 | } | 3827 | } |
3797 | } | 3828 | } |