aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
authorMelanie2010-02-02 03:56:29 +0000
committerMelanie2010-02-02 03:56:29 +0000
commitd5ed92cf3892c507a31da587deb394e8d5842ed6 (patch)
tree270646e8dbf76aec39b83cc77a551ecf9e43f011 /OpenSim/Region/Framework/Scenes/SceneGraph.cs
parentSmall fix for a spurious exception (diff)
parentRevert "improve locking of m_items in SceneObjectPartInventory" (diff)
downloadopensim-SC_OLD-d5ed92cf3892c507a31da587deb394e8d5842ed6.zip
opensim-SC_OLD-d5ed92cf3892c507a31da587deb394e8d5842ed6.tar.gz
opensim-SC_OLD-d5ed92cf3892c507a31da587deb394e8d5842ed6.tar.bz2
opensim-SC_OLD-d5ed92cf3892c507a31da587deb394e8d5842ed6.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs80
1 files changed, 55 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 34a92fe..2c66719 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -502,46 +502,62 @@ namespace OpenSim.Region.Framework.Scenes
502 if (part == null) 502 if (part == null)
503 return; 503 return;
504 504
505 if (!m_parentScene.Permissions.CanTakeObject( 505 if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
506 part.UUID, remoteClient.AgentId))
507 return; 506 return;
508 507
509 // Calls attach with a Zero position 508 // Calls attach with a Zero position
510 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); 509 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
511 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
512
513 // Save avatar attachment information
514 ScenePresence presence;
515 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
516 { 510 {
517 m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); 511 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
518 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 512
513 // Save avatar attachment information
514 ScenePresence presence;
515 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
516 {
517 m_log.Info(
518 "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
519 + ", AttachmentPoint: " + AttachmentPt);
520
521 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
522 }
519 } 523 }
520 } 524 }
521 525
522 public SceneObjectGroup RezSingleAttachment( 526 /// <summary>
523 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 527 /// Rez an attachment
528 /// </summary>
529 /// <param name="remoteClient"></param>
530 /// <param name="itemID"></param>
531 /// <param name="AttachmentPt"></param>
532 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
533 public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
524 { 534 {
525 SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, 535 SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient,
526 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 536 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
527 false, false, remoteClient.AgentId, true); 537 false, false, remoteClient.AgentId, true);
528 538
529
530 if (objatt != null) 539 if (objatt != null)
531 { 540 {
532 bool tainted = false; 541 bool tainted = false;
533 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 542 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
534 tainted = true; 543 tainted = true;
535 544
536 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); 545 if (AttachObject(
537 objatt.ScheduleGroupForFullUpdate(); 546 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false))
538 if (tainted) 547 {
539 objatt.HasGroupChanged = true; 548 objatt.ScheduleGroupForFullUpdate();
540 549 if (tainted)
541 // Fire after attach, so we don't get messy perms dialogs 550 objatt.HasGroupChanged = true;
542 // 3 == AttachedRez 551
543 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); 552 // Fire after attach, so we don't get messy perms dialogs
553 // 3 == AttachedRez
554 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
555
556 // Do this last so that event listeners have access to all the effects of the attachment
557 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
558 }
544 } 559 }
560
545 return objatt; 561 return objatt;
546 } 562 }
547 563
@@ -590,7 +606,17 @@ namespace OpenSim.Region.Framework.Scenes
590 } 606 }
591 } 607 }
592 608
593 protected internal void AttachObject( 609 /// <summary>
610 /// Attach a scene object to an avatar.
611 /// </summary>
612 /// <param name="remoteClient"></param>
613 /// <param name="objectLocalID"></param>
614 /// <param name="AttachmentPt"></param>
615 /// <param name="rot"></param>
616 /// <param name="attachPos"></param>
617 /// <param name="silent"></param>
618 /// <returns>true if the attachment was successful, false otherwise</returns>
619 protected internal bool AttachObject(
594 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) 620 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
595 { 621 {
596 SceneObjectGroup group = GetGroupByPrim(objectLocalID); 622 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
@@ -619,10 +645,8 @@ namespace OpenSim.Region.Framework.Scenes
619 // Stick it on left hand with Zero Offset from the attachment point. 645 // Stick it on left hand with Zero Offset from the attachment point.
620 AttachmentPt = (uint)AttachmentPoint.LeftHand; 646 AttachmentPt = (uint)AttachmentPoint.LeftHand;
621 attachPos = Vector3.Zero; 647 attachPos = Vector3.Zero;
622
623 } 648 }
624 649
625
626 group.SetAttachmentPoint((byte)AttachmentPt); 650 group.SetAttachmentPoint((byte)AttachmentPt);
627 group.AbsolutePosition = attachPos; 651 group.AbsolutePosition = attachPos;
628 652
@@ -645,15 +669,21 @@ namespace OpenSim.Region.Framework.Scenes
645 // it get cleaned up 669 // it get cleaned up
646 // 670 //
647 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 671 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
648 group.HasGroupChanged = false; 672 group.HasGroupChanged = false;
649 } 673 }
650 else 674 else
651 { 675 {
652 remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); 676 remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
677 return false;
653 } 678 }
654 } 679 }
655 else 680 else
681 {
656 m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); 682 m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
683 return false;
684 }
685
686 return true;
657 } 687 }
658 688
659 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 689 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)