Merge branch 'master' of ssh://3dhosting.de/var/git/careminster

avinationmerge
sacha 2010-05-02 08:18:33 -04:00
commit 5f6e9e6ab9
7 changed files with 86 additions and 41 deletions

View File

@ -73,7 +73,7 @@ namespace OpenSim.Framework
public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children);
public delegate void DelinkObjects(List<uint> primIds); public delegate void DelinkObjects(List<uint> primIds, IClientAPI client);
public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag); public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag);

View File

@ -6071,7 +6071,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
DelinkObjects handlerDelinkObjects = OnDelinkObjects; DelinkObjects handlerDelinkObjects = OnDelinkObjects;
if (handlerDelinkObjects != null) if (handlerDelinkObjects != null)
{ {
handlerDelinkObjects(prims); handlerDelinkObjects(prims, this);
} }
return true; return true;

View File

@ -1594,7 +1594,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
return true; return GenericObjectPermission(userID, objectID, false);
} }
private bool CanDelinkObject(UUID userID, UUID objectID) private bool CanDelinkObject(UUID userID, UUID objectID)
@ -1602,7 +1602,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
return true; return GenericObjectPermission(userID, objectID, false);
} }
private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene)

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
byte RayEndIsIntersection) { this.Stale = true; }; byte RayEndIsIntersection) { this.Stale = true; };
client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children) client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children)
{ this.Stale = true; }; { this.Stale = true; };
client.OnDelinkObjects += delegate(List<uint> primIds) { this.Stale = true; }; client.OnDelinkObjects += delegate(List<uint> primIds, IClientAPI clientApi) { this.Stale = true; };
client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos,
IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; };
client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt,

View File

@ -2577,5 +2577,73 @@ namespace OpenSim.Region.Framework.Scenes
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
} }
} }
public void DelinkObjects(List<uint> primIds, IClientAPI client)
{
List<SceneObjectPart> parts = new List<SceneObjectPart>();
foreach (uint localID in primIds)
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
continue;
if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
parts.Add(part);
}
m_sceneGraph.DelinkObjects(parts);
}
public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
{
List<UUID> owners = new List<UUID>();
List<SceneObjectPart> children = new List<SceneObjectPart>();
SceneObjectPart root = GetSceneObjectPart(parentPrimId);
if (root == null)
{
m_log.DebugFormat("[LINK]: Can't find linkset root prim {0{", parentPrimId);
return;
}
if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
{
m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
return;
}
foreach (uint localID in childPrimIds)
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
continue;
if (!owners.Contains(part.OwnerID))
owners.Add(part.OwnerID);
if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
children.Add(part);
}
// Must be all one owner
//
if (owners.Count > 1)
{
m_log.DebugFormat("[LINK]: Refusing link. Too many owners");
return;
}
if (children.Count == 0)
{
m_log.DebugFormat("[LINK]: Refusing link. No permissions to link any of the children");
return;
}
m_sceneGraph.LinkObjects(root, children);
}
} }
} }

View File

@ -2762,8 +2762,8 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectName += m_sceneGraph.PrimName; client.OnObjectName += m_sceneGraph.PrimName;
client.OnObjectClickAction += m_sceneGraph.PrimClickAction; client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
client.OnObjectMaterial += m_sceneGraph.PrimMaterial; client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
client.OnLinkObjects += m_sceneGraph.LinkObjects; client.OnLinkObjects += LinkObjects;
client.OnDelinkObjects += m_sceneGraph.DelinkObjects; client.OnDelinkObjects += DelinkObjects;
client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
@ -2918,8 +2918,8 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectName -= m_sceneGraph.PrimName; client.OnObjectName -= m_sceneGraph.PrimName;
client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
client.OnLinkObjects -= m_sceneGraph.LinkObjects; client.OnLinkObjects -= LinkObjects;
client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; client.OnDelinkObjects -= DelinkObjects;
client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;

View File

@ -1655,20 +1655,21 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="parentPrim"></param> /// <param name="parentPrim"></param>
/// <param name="childPrims"></param> /// <param name="childPrims"></param>
protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
{ {
Monitor.Enter(m_updateLock); Monitor.Enter(m_updateLock);
try try
{ {
SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); SceneObjectGroup parentGroup = root.ParentGroup;
List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
if (parentGroup != null) if (parentGroup != null)
{ {
// We do this in reverse to get the link order of the prims correct // We do this in reverse to get the link order of the prims correct
for (int i = childPrimIds.Count - 1; i >= 0; i--) for (int i = children.Count - 1; i >= 0; i--)
{ {
SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); SceneObjectGroup child = children[i].ParentGroup;
if (child != null) if (child != null)
{ {
// Make sure no child prim is set for sale // Make sure no child prim is set for sale
@ -1701,17 +1702,6 @@ namespace OpenSim.Region.Framework.Scenes
parentGroup.HasGroupChanged = true; parentGroup.HasGroupChanged = true;
parentGroup.ScheduleGroupForFullUpdate(); parentGroup.ScheduleGroupForFullUpdate();
// if (client != null)
// {
// parentGroup.GetProperties(client);
// }
// else
// {
// foreach (ScenePresence p in GetScenePresences())
// {
// parentGroup.GetProperties(p.ControllingClient);
// }
// }
} }
finally finally
{ {
@ -1723,12 +1713,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Delink a linkset /// Delink a linkset
/// </summary> /// </summary>
/// <param name="prims"></param> /// <param name="prims"></param>
protected internal void DelinkObjects(List<uint> primIds) protected internal void DelinkObjects(List<SceneObjectPart> prims)
{
DelinkObjects(primIds, true);
}
protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
{ {
Monitor.Enter(m_updateLock); Monitor.Enter(m_updateLock);
try try
@ -1738,9 +1723,8 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>();
// Look them all up in one go, since that is comparatively expensive // Look them all up in one go, since that is comparatively expensive
// //
foreach (uint primID in primIds) foreach (SceneObjectPart part in prims)
{ {
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID);
if (part != null) if (part != null)
{ {
if (part.ParentGroup.Children.Count != 1) // Skip single if (part.ParentGroup.Children.Count != 1) // Skip single
@ -1755,17 +1739,13 @@ namespace OpenSim.Region.Framework.Scenes
affectedGroups.Add(group); affectedGroups.Add(group);
} }
} }
else
{
m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID);
}
} }
foreach (SceneObjectPart child in childParts) foreach (SceneObjectPart child in childParts)
{ {
// Unlink all child parts from their groups // Unlink all child parts from their groups
// //
child.ParentGroup.DelinkFromGroup(child, sendEvents); child.ParentGroup.DelinkFromGroup(child, true);
} }
foreach (SceneObjectPart root in rootParts) foreach (SceneObjectPart root in rootParts)
@ -1820,12 +1800,9 @@ namespace OpenSim.Region.Framework.Scenes
List<uint> linkIDs = new List<uint>(); List<uint> linkIDs = new List<uint>();
foreach (SceneObjectPart newChild in newSet) foreach (SceneObjectPart newChild in newSet)
{
newChild.UpdateFlag = 0; newChild.UpdateFlag = 0;
linkIDs.Add(newChild.LocalId);
}
LinkObjects(null, newRoot.LocalId, linkIDs); LinkObjects(newRoot, newSet);
if (!affectedGroups.Contains(newRoot.ParentGroup)) if (!affectedGroups.Contains(newRoot.ParentGroup))
affectedGroups.Add(newRoot.ParentGroup); affectedGroups.Add(newRoot.ParentGroup);
} }