From 15ea82e925af419f811a3c8c603bdc1e9103d22c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 2 Sep 2011 00:25:05 +0100
Subject: move more of IAM.RezObject() into DoPreRezWhenFromItem()
---
.../InventoryAccess/InventoryAccessModule.cs | 148 ++++++++++++---------
1 file changed, 85 insertions(+), 63 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 9bc7a09..e94d059 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -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,52 +881,106 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return group;
}
- private void DoPreRezWhenFromItem(InventoryItemBase item, SceneObjectGroup so)
+ ///
+ /// Do pre-rez processing when the object comes from an item.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if we can processed with rezzing, false if we need to abort
+ private bool DoPreRezWhenFromItem(
+ IClientAPI remoteClient, InventoryItemBase item, List 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);
- SceneObjectPart rootPart = so.RootPart;
+ return false;
+ }
- if ((rootPart.OwnerID != item.Owner) ||
- (item.CurrentPermissions & 16) != 0)
+ for (int i = 0; i < objlist.Count; i++)
{
- //Need to kill the for sale here
- rootPart.ObjectSaleType = 0;
- rootPart.SalePrice = 10;
+ 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;
+ }
- if (m_Scene.Permissions.PropagatePermissions())
+ rootPart.FromFolderID = item.Folder;
+
+ if ((rootPart.OwnerID != item.Owner) ||
+ (item.CurrentPermissions & 16) != 0)
{
- foreach (SceneObjectPart part in so.Parts)
+ //Need to kill the for sale here
+ rootPart.ObjectSaleType = 0;
+ rootPart.SalePrice = 10;
+
+ if (m_Scene.Permissions.PropagatePermissions())
{
- if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
+ foreach (SceneObjectPart part in so.Parts)
{
- part.EveryoneMask = item.EveryOnePermissions;
- part.NextOwnerMask = item.NextPermissions;
+ if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
+ {
+ part.EveryoneMask = item.EveryOnePermissions;
+ part.NextOwnerMask = item.NextPermissions;
+ }
+ part.GroupMask = 0; // DO NOT propagate here
}
- part.GroupMask = 0; // DO NOT propagate here
+
+ so.ApplyNextOwnerPermissions();
}
-
- so.ApplyNextOwnerPermissions();
}
- }
-
- foreach (SceneObjectPart part in so.Parts)
- {
- if ((part.OwnerID != item.Owner) ||
- (item.CurrentPermissions & 16) != 0)
+
+ foreach (SceneObjectPart part in so.Parts)
{
- part.LastOwnerID = part.OwnerID;
- part.OwnerID = item.Owner;
- part.Inventory.ChangeInventoryOwner(item.Owner);
- part.GroupMask = 0; // DO NOT propagate here
+ if ((part.OwnerID != item.Owner) ||
+ (item.CurrentPermissions & 16) != 0)
+ {
+ part.LastOwnerID = part.OwnerID;
+ part.OwnerID = item.Owner;
+ part.Inventory.ChangeInventoryOwner(item.Owner);
+ part.GroupMask = 0; // DO NOT propagate here
+ }
+ part.EveryoneMask = item.EveryOnePermissions;
+ part.NextOwnerMask = item.NextPermissions;
}
- part.EveryoneMask = item.EveryOnePermissions;
- part.NextOwnerMask = item.NextPermissions;
+
+ rootPart.TrimPermissions();
}
- rootPart.TrimPermissions();
+ return true;
}
+ ///
+ /// Do post-rez processing when the object comes from an item.
+ ///
+ ///
+ ///
private void DoPostRezWhenFromItem(InventoryItemBase item, bool isAttachment)
{
if (!m_Scene.Permissions.BypassPermissions())
--
cgit v1.1