* 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.
afrisby
Teravus Ovares 2007-11-14 11:56:57 +00:00
parent 61b301cbcd
commit 3cb2b5eb66
6 changed files with 49 additions and 14 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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.

View File

@ -593,7 +593,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="originalPrim"></param>
/// <param name="offset"></param>
/// <param name="flags"></param>
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);

View File

@ -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; }
}
/// <summary>
///
/// </summary>
@ -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
///
/// </summary>
/// <returns></returns>
public new SceneObjectGroup Copy()
public new SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID)
{
SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
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<SceneObjectPart> partList = new List<SceneObjectPart>(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
///
/// </summary>
/// <param name="part"></param>
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();
}
/// <summary>
///
/// </summary>
/// <param name="part"></param>
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

View File

@ -520,13 +520,15 @@ namespace OpenSim.Region.Environment.Scenes
///
/// </summary>
/// <returns></returns>
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 =