From a5c693e302c941be69b7eedaead72bdd3ce7aa59 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 17 Jan 2017 00:41:30 +0000 Subject: start adding calls to effective permissions aggregation on changes; rearrange code in DuplicateObject(); --- .../World/Objects/BuySell/BuySellModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 -- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 27 +++++++++------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 11 ++++----- .../Avatar/Attachments/TempAttachmentsModule.cs | 24 ++++++++++--------- 5 files changed, 29 insertions(+), 36 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 2a7bfb0..4542bbf 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -146,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell child.TriggerScriptChangedEvent(Changed.OWNER); child.ApplyNextOwnerPermissions(); } + group.AggregatePerms(); } part.ObjectSaleType = 0; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c1faf21..ea100ae 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2766,8 +2766,6 @@ namespace OpenSim.Region.Framework.Scenes child.Inventory.ChangeInventoryOwner(groupID); child.TriggerScriptChangedEvent(Changed.OWNER); } - - } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 602ac4b..dad8cac 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2101,20 +2101,23 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup copy = original.Copy(true); copy.AbsolutePosition = copy.AbsolutePosition + offset; + SceneObjectPart[] parts = copy.Parts; + + m_numTotalPrim += parts.Length; + if (original.OwnerID != AgentID) { copy.SetOwner(AgentID, GroupID); - SceneObjectPart[] partList = copy.Parts; - if (m_parentScene.Permissions.PropagatePermissions()) { - foreach (SceneObjectPart child in partList) + foreach (SceneObjectPart child in parts) { child.Inventory.ChangeInventoryOwner(AgentID); child.TriggerScriptChangedEvent(Changed.OWNER); child.ApplyNextOwnerPermissions(); } + copy.AggregatePerms(); } } @@ -2124,10 +2127,6 @@ namespace OpenSim.Region.Framework.Scenes lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID[copy.UUID] = copy; - SceneObjectPart[] parts = copy.Parts; - - m_numTotalPrim += parts.Length; - foreach (SceneObjectPart part in parts) { if (part.GetPrimType() == PrimType.SCULPT) @@ -2150,21 +2149,17 @@ namespace OpenSim.Region.Framework.Scenes // think it's selected, so it will never send a deselect... copy.IsSelected = false; - m_numPrim += copy.Parts.Length; - if (rot != Quaternion.Identity) - { copy.UpdateGroupRotationR(rot); - } + + // required for physics to update it's position + copy.ResetChildPrimPhysicsPositions(); copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); - copy.HasGroupChanged = true; - copy.ScheduleGroupForFullUpdate(); copy.ResumeScripts(); - // required for physics to update it's position - copy.AbsolutePosition = copy.AbsolutePosition; - + copy.HasGroupChanged = true; + copy.ScheduleGroupForFullUpdate(); return copy; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 87ce0b7..0817144 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5243,17 +5243,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter if (OwnerID != item.Owner) { - //LogPermissions("Before ApplyNextOwnerPermissions"); - - if (scene.Permissions.PropagatePermissions()) - ApplyNextOwnerPermissions(); - - //LogPermissions("After ApplyNextOwnerPermissions"); - if(OwnerID != GroupID) LastOwnerID = OwnerID; OwnerID = item.Owner; Inventory.ChangeInventoryOwner(item.Owner); + + if (scene.Permissions.PropagatePermissions()) + ApplyNextOwnerPermissions(); } } @@ -5277,6 +5273,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter GroupMask = 0; // Giving an object zaps group permissions Inventory.ApplyNextOwnerPermissions(); + AggregateInnerPerms(); } public void UpdateLookAt() diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs index 1d5e4fb..2bb48ad 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs @@ -134,11 +134,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) { SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); - if (hostPart == null) return 0; - if (hostPart.ParentGroup.IsAttachment) + SceneObjectGroup hostgroup = hostPart.ParentGroup; + + if (hostgroup== null || hostgroup.IsAttachment) return 0; IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface(); @@ -156,31 +157,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) return 0; - if (target.UUID != hostPart.ParentGroup.OwnerID) + if (target.UUID != hostgroup.OwnerID) { - uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); + uint effectivePerms = hostgroup.GetEffectivePermissions(); if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) return 0; - hostPart.ParentGroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId); + hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId); if (m_scene.Permissions.PropagatePermissions()) { - foreach (SceneObjectPart child in hostPart.ParentGroup.Parts) + foreach (SceneObjectPart child in hostgroup.Parts) { child.Inventory.ChangeInventoryOwner(target.UUID); child.TriggerScriptChangedEvent(Changed.OWNER); child.ApplyNextOwnerPermissions(); } + hostgroup.AggregatePerms(); } - hostPart.ParentGroup.RootPart.ObjectSaleType = 0; - hostPart.ParentGroup.RootPart.SalePrice = 10; + hostgroup.RootPart.ObjectSaleType = 0; + hostgroup.RootPart.SalePrice = 10; - hostPart.ParentGroup.HasGroupChanged = true; - hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient); - hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); + hostgroup.HasGroupChanged = true; + hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient); + hostgroup.RootPart.ScheduleFullUpdate(); } return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0; -- cgit v1.1