From 3cb2b5eb6686d4e183eed5152570b7e052381f8d Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 14 Nov 2007 11:56:57 +0000 Subject: * Copied objects are now owned by the object copier (Next Owner) (however next owner permissions are not applied yet) * In Serverside permissions mode; If you've copied an object, then you can delete it and clean up after yourself. The rest of the permissions functionality is still unchanged. Admin can delete any object.. etc. --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 45 ++++++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a9f0bb3..c9b6e9f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -73,7 +73,11 @@ namespace OpenSim.Region.Environment.Scenes { get { return m_rootPart.RotationOffset; } } - + public LLUUID GroupID + { + get { return m_rootPart.GroupID; } + set { m_rootPart.GroupID = value; } + } /// /// /// @@ -165,6 +169,7 @@ namespace OpenSim.Region.Environment.Scenes public LLUUID OwnerID { get { return m_rootPart.OwnerID; } + set { m_rootPart.OwnerID = value; } } public Color Color @@ -447,15 +452,18 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public new SceneObjectGroup Copy() + public new SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID) { SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone(); dupe.m_parts = new Dictionary(); dupe.m_parts.Clear(); + //dupe.OwnerID = AgentID; + //dupe.GroupID = GroupID; dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); dupe.m_scene = m_scene; dupe.m_regionHandle = m_regionHandle; - dupe.CopyRootPart(m_rootPart); + dupe.CopyRootPart(m_rootPart, OwnerID, GroupID); + /// may need to create a new Physics actor. if (dupe.RootPart.PhysActor != null) @@ -472,18 +480,29 @@ namespace OpenSim.Region.Environment.Scenes dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), dupe.RootPart.PhysActor.IsPhysical); } + // Now we've made a copy that replaces this one, we need to + // switch the owner to the person who did the copying + // Second Life copies an object and duplicates the first one in it's place + // So, we have to make a copy of this one, set it in it's place then set the owner on this one + + SetRootPartOwner(m_rootPart, cAgentID, cGroupID); + m_rootPart.ScheduleFullUpdate(); List partList = new List(m_parts.Values); foreach (SceneObjectPart part in partList) { if (part.UUID != m_rootPart.UUID) { - dupe.CopyPart(part); + dupe.CopyPart(part,OwnerID, GroupID); + SetPartOwner(part, cAgentID, cGroupID); + part.ScheduleFullUpdate(); + } } dupe.UpdateParentIDs(); dupe.AttachToBackup(); + ScheduleGroupForFullUpdate(); return dupe; } @@ -492,25 +511,35 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CopyRootPart(SceneObjectPart part) + public void CopyRootPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) { - SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); + SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); newPart.SetParent(this); m_parts.Add(newPart.UUID, newPart); SetPartAsRoot(newPart); } + public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) { + part.OwnerID = cAgentID; + part.GroupID = cGroupID; + part.ScheduleFullUpdate(); + } /// /// /// /// - public void CopyPart(SceneObjectPart part) + public void CopyPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) { - SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); + SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); newPart.SetParent(this); m_parts.Add(newPart.UUID, newPart); SetPartAsNonRoot(newPart); } + public void SetPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) + { + part.OwnerID = cAgentID; + part.GroupID = cGroupID; + } #endregion -- cgit v1.1