本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.GetNewItemPermissions方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.GetNewItemPermissions方法的具体用法?C# SceneObjectGroup.GetNewItemPermissions怎么用?C# SceneObjectGroup.GetNewItemPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.GetNewItemPermissions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachObjectAssetStore
public UUID AttachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, UUID destFolderID, out UUID itemID)
{
itemID = UUID.Zero;
if (grp != null)
{
byte[] sceneObjectData = this.DoSerializeSingleGroup(grp, SerializationFlags.None);
CachedUserInfo userInfo =
CommsManager.UserService.GetUserDetails(AgentId);
if (userInfo != null)
{
AssetBase asset = CreateAsset(
grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object,
sceneObjectData);
try
{
CommsManager.AssetCache.AddAsset(asset, AssetRequestInfo.InternalRequest());
}
catch (AssetServerException e)
{
m_log.ErrorFormat("[ATTACHMENT] Unable to attach object. Storing asset failed: {0}", e);
return UUID.Zero;
}
if (destFolderID != UUID.Zero)
{
//make sure we own the folder this item is headed to and that it exists
try
{
//will throw InventorySecurityException, or InventoryObjectMissingException
//if something is wrong
userInfo.GetFolderAttributesChecked(destFolderID);
}
catch (Exception)
{
destFolderID = UUID.Zero;
}
}
if (destFolderID == UUID.Zero)
{
InventoryFolderBase objFolder = userInfo.FindFolderForType((int)InventoryType.Object);
destFolderID = objFolder.ID;
}
InventoryItemBase item = new InventoryItemBase();
item.CreatorId = grp.RootPart.CreatorID.ToString();
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
item.Folder = destFolderID;
item.CreationDate = Util.UnixTimeSinceEpoch();
ItemPermissionBlock newPerms = grp.GetNewItemPermissions(remoteClient.AgentId);
newPerms.ApplyToOther(item);
// sets assetID so client can show asset as 'attached' in inventory
grp.SetFromItemID(item.ID);
userInfo.AddItem(item);
remoteClient.SendInventoryItemCreateUpdate(item, 0);
itemID = item.ID;
return item.AssetID;
}
return UUID.Zero;
}
return UUID.Zero;
}
示例2: TestCoalescedSerializationDeserialization
public void TestCoalescedSerializationDeserialization()
{
var sop1 = Util.RandomSOP("Root", 1);
var sop2 = Util.RandomSOP("Child1", 2);
var sop3 = Util.RandomSOP("Child2", 3);
SceneObjectGroup group = new SceneObjectGroup(sop1);
group.AddPart(sop2);
group.AddPart(sop3);
var sop4 = Util.RandomSOP("Root2", 1);
var sop5 = Util.RandomSOP("Child12", 2);
var sop6 = Util.RandomSOP("Child22", 3);
SceneObjectGroup group2 = new SceneObjectGroup(sop4);
group2.AddPart(sop5);
group2.AddPart(sop6);
var gp1perms = group.GetNewItemPermissions(UUID.Random());
var gp2perms = group2.GetNewItemPermissions(UUID.Random());
var perms = new Dictionary<UUID, ItemPermissionBlock>();
perms[group.UUID] = gp1perms;
perms[group2.UUID] = gp2perms;
CoalescedObject cobj = new CoalescedObject(
new List<SceneObjectGroup> { group, group2 },
perms
);
var colbytes = serEngine.CoalescedObjectSerializer.SerializeObjectToBytes(cobj, SerializationFlags.None);
var deserColObj = serEngine.CoalescedObjectSerializer.DeserializeObjectFromBytes(colbytes);
CompareObjects comp = new CompareObjects();
comp.CompareStaticFields = false;
comp.CompareStaticProperties = false;
comp.ElementsToIgnore = PrimCompareIgnoreList;
Assert.IsTrue(comp.Compare(cobj, deserColObj), comp.DifferencesString);
}