aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs113
1 files changed, 34 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6332beb..bf4d60c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -647,7 +647,7 @@ namespace OpenSim.Region.Framework.Scenes
647 localIDs.Add(sog.RootPart.LocalId); 647 localIDs.Add(sog.RootPart.LocalId);
648 sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, 648 sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
649 "Returned at region cross"); 649 "Returned at region cross");
650 sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero); 650 sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
651 } 651 }
652 catch (Exception) 652 catch (Exception)
653 { 653 {
@@ -1785,63 +1785,6 @@ namespace OpenSim.Region.Framework.Scenes
1785 } 1785 }
1786 } 1786 }
1787 1787
1788 /// <summary>
1789 /// Attach this scene object to the given avatar.
1790 /// </summary>
1791 /// <param name="agentID"></param>
1792 /// <param name="attachmentpoint"></param>
1793 /// <param name="AttachOffset"></param>
1794 private void AttachToAgent(
1795 ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
1796 {
1797 if (avatar != null)
1798 {
1799 // don't attach attachments to child agents
1800 if (avatar.IsChildAgent) return;
1801
1802 // Remove from database and parcel prim count
1803 m_scene.DeleteFromStorage(so.UUID);
1804 m_scene.EventManager.TriggerParcelPrimCountTainted();
1805
1806 so.AttachedAvatar = avatar.UUID;
1807
1808 if (so.RootPart.PhysActor != null)
1809 {
1810 m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
1811 so.RootPart.PhysActor = null;
1812 }
1813
1814 so.AbsolutePosition = attachOffset;
1815 so.RootPart.AttachedPos = attachOffset;
1816 so.IsAttachment = true;
1817 so.RootPart.SetParentLocalId(avatar.LocalId);
1818 so.AttachmentPoint = attachmentpoint;
1819
1820 avatar.AddAttachment(this);
1821
1822 if (!silent)
1823 {
1824 // Killing it here will cause the client to deselect it
1825 // It then reappears on the avatar, deselected
1826 // through the full update below
1827 //
1828 if (IsSelected)
1829 {
1830 m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId });
1831 }
1832
1833 IsSelected = false; // fudge....
1834 ScheduleGroupForFullUpdate();
1835 }
1836 }
1837 else
1838 {
1839 m_log.WarnFormat(
1840 "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
1841 UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
1842 }
1843 }
1844
1845 public byte GetAttachmentPoint() 1788 public byte GetAttachmentPoint()
1846 { 1789 {
1847 return m_rootPart.Shape.State; 1790 return m_rootPart.Shape.State;
@@ -2313,7 +2256,7 @@ namespace OpenSim.Region.Framework.Scenes
2313 RootPart.UUID); 2256 RootPart.UUID);
2314 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); 2257 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
2315 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 2258 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
2316 DeRezAction.Return, UUID.Zero); 2259 DeRezAction.Return, UUID.Zero, false);
2317 2260
2318 return; 2261 return;
2319 } 2262 }
@@ -2443,17 +2386,16 @@ namespace OpenSim.Region.Framework.Scenes
2443 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 2386 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
2444 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 2387 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
2445 2388
2446
2447 if (userExposed) 2389 if (userExposed)
2448 dupe.m_rootPart.TrimPermissions(); 2390 dupe.m_rootPart.TrimPermissions();
2449 2391
2450 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray()); 2392 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray());
2451 2393
2452 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) 2394 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
2453 { 2395 {
2454 return p1.LinkNum.CompareTo(p2.LinkNum); 2396 return p1.LinkNum.CompareTo(p2.LinkNum);
2455 } 2397 }
2456 ); 2398 );
2457 2399
2458 foreach (SceneObjectPart part in partList) 2400 foreach (SceneObjectPart part in partList)
2459 { 2401 {
@@ -2505,10 +2447,12 @@ namespace OpenSim.Region.Framework.Scenes
2505 if (dupe.m_rootPart.PhysActor != null) 2447 if (dupe.m_rootPart.PhysActor != null)
2506 dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building 2448 dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
2507 2449
2450 dupe.AggregateDeepPerms();
2451
2508 dupe.HasGroupChanged = true; 2452 dupe.HasGroupChanged = true;
2509 dupe.AttachToBackup(); 2453 dupe.AttachToBackup();
2510 2454
2511 ScheduleGroupForFullUpdate(); 2455 dupe.ScheduleGroupForFullUpdate();
2512 } 2456 }
2513 2457
2514 m_dupeInProgress = false; 2458 m_dupeInProgress = false;
@@ -2746,25 +2690,33 @@ namespace OpenSim.Region.Framework.Scenes
2746 } 2690 }
2747 2691
2748 /// <summary> 2692 /// <summary>
2749 /// Set the owner of the root part. 2693 /// Set the owner of all linkset.
2750 /// </summary> 2694 /// </summary>
2751 /// <param name="part"></param>
2752 /// <param name="cAgentID"></param> 2695 /// <param name="cAgentID"></param>
2753 /// <param name="cGroupID"></param> 2696 /// <param name="cGroupID"></param>
2754 public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID) 2697 public void SetOwner(UUID cAgentID, UUID cGroupID)
2755 { 2698 {
2756 part.LastOwnerID = part.OwnerID; 2699 SceneObjectPart rpart = RootPart;
2757 part.OwnerID = cAgentID; 2700 UUID oldowner = rpart.OwnerID;
2758 part.GroupID = cGroupID; 2701 ForEachPart(delegate(SceneObjectPart part)
2702 {
2703 if(part.GroupID != part.OwnerID)
2704 part.LastOwnerID = part.OwnerID;
2705 part.OwnerID = cAgentID;
2706 part.GroupID = cGroupID;
2707 });
2759 2708
2760 if (part.OwnerID != cAgentID) 2709 if (oldowner != cAgentID)
2761 { 2710 {
2762 // Apply Next Owner Permissions if we're not bypassing permissions 2711 // Apply Next Owner Permissions if we're not bypassing permissions
2763 if (!m_scene.Permissions.BypassPermissions()) 2712 if (!m_scene.Permissions.BypassPermissions())
2713 {
2764 ApplyNextOwnerPermissions(); 2714 ApplyNextOwnerPermissions();
2715 AggregatePerms();
2716 }
2765 } 2717 }
2766 2718
2767 part.ScheduleFullUpdate(); 2719 rpart.ScheduleFullUpdate();
2768 } 2720 }
2769 2721
2770 /// <summary> 2722 /// <summary>
@@ -3420,6 +3372,7 @@ namespace OpenSim.Region.Framework.Scenes
3420 objectGroup.HasGroupChangedDueToDelink = true; 3372 objectGroup.HasGroupChangedDueToDelink = true;
3421 3373
3422 InvalidBoundsRadius(); 3374 InvalidBoundsRadius();
3375 objectGroup.AggregatePerms();
3423 3376
3424 if (sendEvents) 3377 if (sendEvents)
3425 linkPart.TriggerScriptChangedEvent(Changed.LINK); 3378 linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -3958,8 +3911,8 @@ namespace OpenSim.Region.Framework.Scenes
3958 3911
3959 public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) 3912 public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
3960 { 3913 {
3961 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits 3914 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits
3962 uint foldedPerms = RootPart.OwnerMask & 3; 3915 uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask;
3963 3916
3964 ForEachPart(part => 3917 ForEachPart(part =>
3965 { 3918 {
@@ -3970,14 +3923,14 @@ namespace OpenSim.Region.Framework.Scenes
3970 part.Inventory.ApplyGodPermissions(part.BaseMask); 3923 part.Inventory.ApplyGodPermissions(part.BaseMask);
3971 }); 3924 });
3972 3925
3973 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); 3926 uint lockMask = ~(uint)(PermissionMask.Move);
3974 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); 3927 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move);
3975 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); 3928 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
3976 3929
3977// m_log.DebugFormat( 3930// m_log.DebugFormat(
3978// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", 3931// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
3979// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); 3932// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
3980 3933 AggregatePerms();
3981 RootPart.ScheduleFullUpdate(); 3934 RootPart.ScheduleFullUpdate();
3982 } 3935 }
3983 3936
@@ -4002,6 +3955,7 @@ namespace OpenSim.Region.Framework.Scenes
4002 { 3955 {
4003 foreach (SceneObjectPart part in Parts) 3956 foreach (SceneObjectPart part in Parts)
4004 part.Inventory.ApplyGodPermissions(RootPart.BaseMask); 3957 part.Inventory.ApplyGodPermissions(RootPart.BaseMask);
3958 AggregatePerms();
4005 } 3959 }
4006 3960
4007 HasGroupChanged = true; 3961 HasGroupChanged = true;
@@ -4647,7 +4601,7 @@ namespace OpenSim.Region.Framework.Scenes
4647 } 4601 }
4648 if ((change & ObjectChangeType.Position) != 0) 4602 if ((change & ObjectChangeType.Position) != 0)
4649 { 4603 {
4650 if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) 4604 if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position))
4651 UpdateGroupPosition(data.position); 4605 UpdateGroupPosition(data.position);
4652 updateType = updatetype.groupterse; 4606 updateType = updatetype.groupterse;
4653 } 4607 }
@@ -5217,6 +5171,7 @@ namespace OpenSim.Region.Framework.Scenes
5217 { 5171 {
5218 part.ResetOwnerChangeFlag(); 5172 part.ResetOwnerChangeFlag();
5219 }); 5173 });
5174 AggregatePerms();
5220 } 5175 }
5221 5176
5222 // clear some references to easy cg 5177 // clear some references to easy cg