diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index d577a201fd..451984c1e4 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Framework
public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
- public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags);
+ public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags, LLUUID AgentID, LLUUID GroupID);
public delegate void StatusChange(bool status);
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 1383ad95f5..da4f830ce0 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -298,12 +298,13 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.ObjectDuplicate:
ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack;
+ ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
for (int i = 0; i < dupe.ObjectData.Length; i++)
{
if (OnObjectDuplicate != null)
{
OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
- dupe.SharedData.DuplicateFlags);
+ dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, AgentandGroupData.GroupID);
}
}
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index fd55833569..560ecf3f11 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -139,9 +139,12 @@ namespace OpenSim.Region.Environment
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID taskOwner = null;
+ // Added this because at this point in time it wouldn't be wise for
+ // the administrator object permissions to take effect.
+ LLUUID objectOwner = task.OwnerID;
// Object owners should be able to edit their own content
- if (user == taskOwner)
+ if (user == objectOwner)
permission = true;
// Users should be able to edit what is over their land.
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index c8e9b73659..c436b8999f 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -593,7 +593,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags)
+ public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags, LLUUID AgentID, LLUUID GroupID)
{
SceneObjectGroup originPrim = null;
foreach (EntityBase ent in Entities.Values)
@@ -610,7 +610,7 @@ namespace OpenSim.Region.Environment.Scenes
if (originPrim != null)
{
- SceneObjectGroup copy = originPrim.Copy();
+ SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
copy.AbsolutePosition = copy.AbsolutePosition + offset;
Entities.Add(copy.UUID, copy);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index a9f0bb3a85..c9b6e9f969 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
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 52bea40143..70b8829ebc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -520,13 +520,15 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public SceneObjectPart Copy(uint localID)
+ public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID)
{
SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle;
dupe.UUID = LLUUID.Random();
dupe.LocalID = localID;
+ dupe.OwnerID = AgentID;
+ dupe.GroupID = GroupID;
dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z);
dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
dupe.RotationOffset =