move more of IAM.RezObject() into DoPreRezWhenFromItem()

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-02 00:25:05 +01:00
parent 01146bb3e3
commit 15ea82e925
1 changed files with 88 additions and 66 deletions

View File

@ -803,24 +803,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
}
int primcount = 0;
foreach (SceneObjectGroup g in objlist)
primcount += g.PrimCount;
if (!m_Scene.Permissions.CanRezObject(
primcount, remoteClient.AgentId, pos)
&& !attachment)
{
// The client operates in no fail mode. It will
// have already removed the item from the folder
// if it's no copy.
// Put it back if it's not an attachment
//
if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
remoteClient.SendBulkUpdateInventory(item);
if (!DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment))
return null;
}
for (int i = 0; i < objlist.Count; i++)
{
@ -829,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Vector3 storedPosition = group.AbsolutePosition;
if (group.UUID == UUID.Zero)
{
m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3");
m_log.Debug("[InventoryAccessModule]: Object has UUID.Zero! Position 3");
}
// If it's rezzed in world, select it. Much easier to
@ -873,24 +857,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
SceneObjectPart rootPart = group.RootPart;
// Since renaming the item in the inventory does not
// affect the name stored in the serialization, transfer
// the correct name from the inventory to the
// object itself before we rez.
//
// Only do these for the first object if we are rezzing a coalescence.
if (i == 0)
{
rootPart.Name = item.Name;
rootPart.Description = item.Description;
rootPart.ObjectSaleType = item.SaleType;
rootPart.SalePrice = item.SalePrice;
}
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
DoPreRezWhenFromItem(item, group);
if (!attachment)
{
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
@ -913,12 +881,58 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return group;
}
private void DoPreRezWhenFromItem(InventoryItemBase item, SceneObjectGroup so)
/// <summary>
/// Do pre-rez processing when the object comes from an item.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="item"></param>
/// <param name="objlist"></param>
/// <param name="pos"></param>
/// <param name="isAttachment"></param>
/// <returns>true if we can processed with rezzing, false if we need to abort</returns>
private bool DoPreRezWhenFromItem(
IClientAPI remoteClient, InventoryItemBase item, List<SceneObjectGroup> objlist, Vector3 pos, bool isAttachment)
{
so.RootPart.FromFolderID = item.Folder;
int primcount = 0;
foreach (SceneObjectGroup g in objlist)
primcount += g.PrimCount;
if (!m_Scene.Permissions.CanRezObject(
primcount, remoteClient.AgentId, pos)
&& !isAttachment)
{
// The client operates in no fail mode. It will
// have already removed the item from the folder
// if it's no copy.
// Put it back if it's not an attachment
//
if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!isAttachment))
remoteClient.SendBulkUpdateInventory(item);
return false;
}
for (int i = 0; i < objlist.Count; i++)
{
SceneObjectGroup so = objlist[i];
SceneObjectPart rootPart = so.RootPart;
// Since renaming the item in the inventory does not
// affect the name stored in the serialization, transfer
// the correct name from the inventory to the
// object itself before we rez.
//
// Only do these for the first object if we are rezzing a coalescence.
if (i == 0)
{
rootPart.Name = item.Name;
rootPart.Description = item.Description;
rootPart.ObjectSaleType = item.SaleType;
rootPart.SalePrice = item.SalePrice;
}
rootPart.FromFolderID = item.Folder;
if ((rootPart.OwnerID != item.Owner) ||
(item.CurrentPermissions & 16) != 0)
{
@ -959,6 +973,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.TrimPermissions();
}
return true;
}
/// <summary>
/// Do post-rez processing when the object comes from an item.
/// </summary>
/// <param name="item"></param>
/// <param name="isAttachment"></param>
private void DoPostRezWhenFromItem(InventoryItemBase item, bool isAttachment)
{
if (!m_Scene.Permissions.BypassPermissions())