From 23578635df0c98f883f7be9b6e08a4fc1a7c834c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Aug 2016 15:19:42 +0100 Subject: more changes relative to incorrect use of activegroupid --- OpenSim/Framework/IClientAPI.cs | 7 +++-- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 36 ++++++++++++++-------- .../InventoryAccess/HGInventoryAccessModule.cs | 20 +++++++++--- .../InventoryAccess/InventoryAccessModule.cs | 35 ++++++++++++++++----- .../Tests/InventoryAccessModuleTests.cs | 2 +- .../Framework/Interfaces/IInventoryAccessModule.cs | 17 +++++++++- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 +++-- OpenSim/Region/Framework/Scenes/Scene.cs | 14 --------- .../Framework/Scenes/Tests/UserInventoryTests.cs | 2 +- .../OptionalModules/DataSnapshot/ObjectSnapshot.cs | 3 +- 10 files changed, 95 insertions(+), 48 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 9bf51f8..018f194 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -47,9 +47,10 @@ namespace OpenSim.Framework public delegate void ImprovedInstantMessage(IClientAPI remoteclient, GridInstantMessage im); - public delegate void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, - UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, - bool RezSelected, bool RemoveItem, UUID fromTaskID); + public delegate void RezObject(IClientAPI remoteClient, UUID itemID, UUID GroupID, + Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID); public delegate void RezRestoreToWorld(IClientAPI remoteClient, UUID itemId); public delegate ISceneEntity RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 088cd4c..e3b2fd1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5805,9 +5805,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public ulong GetGroupPowers(UUID groupID) { - if (groupID == ActiveGroupId) - return ActiveGroupPowers; - lock(m_groupPowers) { if (m_groupPowers.ContainsKey(groupID)) @@ -6729,11 +6726,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP RezObject handlerRezObject = OnRezObject; if (handlerRezObject != null) { - handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, - rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, - rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, - rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, - rezPacket.RezData.FromTaskID); + UUID rezGroupID = rezPacket.AgentData.GroupID; + if(!IsGroupMember(rezGroupID)) + rezGroupID = UUID.Zero; + handlerRezObject(this, rezPacket.InventoryData.ItemID, rezGroupID, rezPacket.RezData.RayEnd, + rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, + rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, + rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, + rezPacket.RezData.FromTaskID); } return true; } @@ -7644,9 +7644,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerObjectDuplicate = OnObjectDuplicate; if (handlerObjectDuplicate != null) { + UUID rezGroupID = dupe.AgentData.GroupID; + if(!IsGroupMember(rezGroupID)) + rezGroupID = UUID.Zero; handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags, AgentId, - dupe.AgentData.GroupID); + rezGroupID); } } @@ -8266,10 +8269,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; if (handlerObjectDuplicateOnRay != null) { - handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, - AgentId, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, - dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, - dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); + + UUID rezGroupID = dupeOnRay.AgentData.GroupID; + if(!IsGroupMember(rezGroupID)) + rezGroupID = UUID.Zero; + + handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, + dupeOnRay.AgentData.DuplicateFlags, AgentId, rezGroupID, + dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, + dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, + dupeOnRay.AgentData.RayEndIsIntersection, + dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 4119f90..4d7c25b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -306,9 +306,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess /// /// RezObject /// - public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, - UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, - bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) + // compatibility do not use + public override SceneObjectGroup RezObject( + IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) + { + return RezObject(remoteClient, itemID, UUID.Zero, RayEnd, RayStart, + RayTargetID, BypassRayCast, RayEndIsIntersection, + RezSelected, RemoveItem, fromTaskID, attachment); + } + + public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, + UUID groupID, Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); @@ -331,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess //} // OK, we're done fetching. Pass it up to the default RezObject - SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, + SceneObjectGroup sog = base.RezObject(remoteClient, itemID, groupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, RezSelected, RemoveItem, fromTaskID, attachment); return sog; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8c560e5..00e2670 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -818,12 +818,22 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return item; } - + // compatibility do not use public virtual SceneObjectGroup RezObject( IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { + return RezObject(remoteClient, itemID, UUID.Zero, RayEnd, RayStart, + RayTargetID, BypassRayCast, RayEndIsIntersection, + RezSelected, RemoveItem, fromTaskID, attachment); + } + + public virtual SceneObjectGroup RezObject( + IClientAPI remoteClient, UUID itemID, UUID rezGroupID, Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) + { // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); @@ -835,16 +845,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.Owner = remoteClient.AgentId; return RezObject( - remoteClient, item, item.AssetID, + remoteClient, item, rezGroupID, item.AssetID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, RezSelected, RemoveItem, fromTaskID, attachment); } - + // compatility public virtual SceneObjectGroup RezObject( IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { + return RezObject(remoteClient, item, UUID.Zero, assetID, + RayEnd, RayStart, RayTargetID, + BypassRayCast, RayEndIsIntersection, + RezSelected, RemoveItem, fromTaskID, attachment); + } + + public virtual SceneObjectGroup RezObject( + IClientAPI remoteClient, InventoryItemBase item, UUID groupID, UUID assetID, + Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, + byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) + { AssetBase rezAsset = m_Scene.AssetService.Get(assetID.ToString()); if (rezAsset == null) @@ -986,6 +1008,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess group.IsAttachment = true; } + group.SetGroup(groupID, remoteClient); + // If we're rezzing an attachment then don't ask // AddNewSceneObject() to update the client since // we'll be doing that later on. Scheduling more than @@ -995,12 +1019,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess m_Scene.AddNewSceneObject(group, true, false); if (!attachment) + { group.AbsolutePosition = pos + veclist[i]; - group.SetGroup(remoteClient.ActiveGroupId, remoteClient); - - if (!attachment) - { // Fire on_rez group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); rootPart.ParentGroup.ResumeScripts(); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 172b864..b31d4df 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests SceneObjectGroup so = m_iam.RezObject( - m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); + m_tc, item1Id, UUID.Zero, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); Assert.That(so, Is.Not.Null); diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 6bad018..292b0d6 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs @@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// + /// /// /// /// @@ -81,6 +82,11 @@ namespace OpenSim.Region.Framework.Interfaces /// /// The SceneObjectGroup rezzed or null if rez was unsuccessful. SceneObjectGroup RezObject( + IClientAPI remoteClient, UUID itemID, UUID rezGroupID, Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); + // compatibily do not use + SceneObjectGroup RezObject( IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); @@ -97,6 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The item from which the object asset came. Can be null, in which case pre and post rez item adjustment and checks are not performed. /// /// The asset id for the object to rez. + /// The requested group id for the object to rez. /// /// /// @@ -107,8 +114,16 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// The SceneObjectGroup rezzed or null if rez was unsuccessful. + + SceneObjectGroup RezObject(IClientAPI remoteClient, InventoryItemBase item, UUID rezGroupID, + UUID assetID, Vector3 RayEnd, Vector3 RayStart, + UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); + + // compatibility do not use SceneObjectGroup RezObject( - IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart, + IClientAPI remoteClient, InventoryItemBase item, + UUID assetID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f2df364..7152015 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2454,6 +2454,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// + /// /// /// /// @@ -2464,7 +2465,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public virtual void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, + public virtual void RezObject(IClientAPI remoteClient, UUID itemID, UUID groupID, + Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID) { @@ -2504,8 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); - Vector3 pos - = GetNewRezLocation( + Vector3 pos = GetNewRezLocation( RayStart, RayEnd, RayTargetID, Quaternion.Identity, BypassRayCast, bRayEndIsIntersection, true, scale, false); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 00e699e..33418e6 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3115,14 +3115,9 @@ namespace OpenSim.Region.Framework.Scenes || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; CheckHeartbeat(); - sp = GetScenePresence(client.AgentId); - // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this - // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause - // other problems, and possibly the code calling AddNewAgent() should ensure that no client is already - // connected. if (sp == null) { m_log.DebugFormat( @@ -3137,15 +3132,6 @@ namespace OpenSim.Region.Framework.Scenes sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; -/* done in completMovement - InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); - if (cof == null) - sp.COF = UUID.Zero; - else - sp.COF = cof.ID; - - m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); - */ m_eventManager.TriggerOnNewPresence(sp); } else diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 75b073d..142ad84 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Tests //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); // Rez the object - scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); + scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, UUID.Zero, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); SceneObjectGroup sog = scene.GetSceneObjectGroup("SomeObject"); Assert.That(sog, Is.Not.Null); diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs index 0bb4044..caca303 100644 --- a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs @@ -83,7 +83,8 @@ namespace OpenSim.Region.DataSnapshot.Providers { this.Stale = true; }; client.OnObjectPermissions += delegate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) { this.Stale = true; }; - client.OnRezObject += delegate(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, + client.OnRezObject += delegate(IClientAPI remoteClient, UUID itemID, UUID groupID, + Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID) { this.Stale = true; }; -- cgit v1.1