本文整理汇总了C#中ISceneEntity.ChildrenEntities方法的典型用法代码示例。如果您正苦于以下问题:C# ISceneEntity.ChildrenEntities方法的具体用法?C# ISceneEntity.ChildrenEntities怎么用?C# ISceneEntity.ChildrenEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneEntity
的用法示例。
在下文中一共展示了ISceneEntity.ChildrenEntities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetEntityIDs
/// <summary>
/// Reset all of the UUID's, localID's, etc in this group (includes children)
/// </summary>
/// <param name="entity"></param>
private void ResetEntityIDs (ISceneEntity entity)
{
List<ISceneChildEntity> children = entity.ChildrenEntities ();
//Sort so that we rebuild in the same order and the root being first
children.Sort(LinkSetSorter);
entity.ClearChildren();
foreach (ISceneChildEntity child in children)
{
child.ResetEntityIDs();
entity.AddChild(child, child.LinkNum);
}
}
示例2: CanUserArchiveObject
/// <summary>
/// Checks whether the user has permission to export an object group to an OAR.
/// </summary>
/// <param name="user">The user</param>
/// <param name="objGroup">The object group</param>
/// <param name="checkPermissions">Which permissions to check: "C" = Copy, "T" = Transfer</param>
/// <returns>Whether the user is allowed to export the object to an OAR</returns>
private bool CanUserArchiveObject(UUID user, ISceneEntity objGroup, string checkPermissions)
{
if (checkPermissions == null)
return true;
IPermissionsModule module = m_scene.RequestModuleInterface<IPermissionsModule>();
if (module == null)
return true; // this shouldn't happen
// Check whether the user is permitted to export all of the parts in the SOG. If any
// part can't be exported then the entire SOG can't be exported.
bool permitted = true;
//int primNumber = 1;
foreach (ISceneChildEntity obj in objGroup.ChildrenEntities())
{
uint perm;
PermissionClass permissionClass = module.GetPermissionClass(user, obj);
switch (permissionClass)
{
case PermissionClass.Owner:
perm = obj.BaseMask;
break;
case PermissionClass.Group:
perm = obj.GroupMask | obj.EveryoneMask;
break;
case PermissionClass.Everyone:
default:
perm = obj.EveryoneMask;
break;
}
bool canCopy = (perm & (uint)PermissionMask.Copy) != 0;
bool canTransfer = (perm & (uint)PermissionMask.Transfer) != 0;
// Special case: if Everyone can copy the object then this implies it can also be
// Transferred.
// However, if the user is the Owner then we don't check EveryoneMask, because it seems that the mask
// always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
// does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
if (permissionClass != PermissionClass.Owner)
{
canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
}
bool partPermitted = true;
if (checkPermissions.Contains("C") && !canCopy)
partPermitted = false;
if (checkPermissions.Contains("T") && !canTransfer)
partPermitted = false;
//string name = (objGroup.PrimCount == 1) ? objGroup.Name : string.Format("{0} ({1}/{2})", obj.Name, primNumber, objGroup.PrimCount);
//m_log.DebugFormat("[ARCHIVER]: Object permissions: {0}: Base={1:X4}, Owner={2:X4}, Everyone={3:X4}, permissionClass={4}, checkPermissions={5}, canCopy={6}, canTransfer={7}, permitted={8}",
// name, obj.BaseMask, obj.OwnerMask, obj.EveryoneMask,
// permissionClass, checkPermissions, canCopy, canTransfer, permitted);
if (!partPermitted)
{
permitted = false;
break;
}
//++primNumber;
}
return permitted;
}
示例3: RestorePrimToScene
/// <summary>
/// Add the Entity to the Scene and back it up, but do NOT reset its ID's
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public bool RestorePrimToScene(ISceneEntity entity)
{
List<ISceneChildEntity> children = entity.ChildrenEntities ();
//Sort so that we rebuild in the same order and the root being first
children.Sort(LinkSetSorter);
entity.ClearChildren();
foreach (ISceneChildEntity child in children)
{
if (((SceneObjectPart)child).PhysActor != null)
((SceneObjectPart)child).PhysActor.LocalID = child.LocalId;
if (child.LocalId == 0)
child.LocalId = AllocateLocalId();
entity.AddChild(child, child.LinkNum);
}
//Tell the entity that they are being added to a scene
entity.AttachToScene(m_parentScene);
//Now save the entity that we have
return AddEntity(entity, false);
}
示例4: ResetEntityIDs
/// <summary>
/// Reset all of the UUID's, localID's, etc in this group (includes children)
/// </summary>
/// <param name="entity"></param>
private void ResetEntityIDs(ISceneEntity entity)
{
List<ISceneChildEntity> children = entity.ChildrenEntities();
//Sort so that we rebuild in the same order and the root being first
children.Sort(LinkSetSorter);
entity.ClearChildren();
foreach (ISceneChildEntity child in children)
{
UUID oldID = child.UUID;
child.ResetEntityIDs();
entity.AddChild(child, child.LinkNum);
}
//This clears the xml file, which will need rebuilt now that we have changed the UUIDs
entity.HasGroupChanged = true;
foreach (ISceneChildEntity child in children)
{
if (!child.IsRoot)
{
child.SetParentLocalId(entity.RootChild.LocalId);
}
}
}
示例5: CacheCreators
private void CacheCreators(ISceneEntity sog)
{
//MainConsole.Instance.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification);
AddUser (sog.RootChild.CreatorID, sog.RootChild.CreatorData);
foreach (ISceneChildEntity sop in sog.ChildrenEntities())
{
AddUser (sop.CreatorID, sop.CreatorData);
foreach (TaskInventoryItem item in sop.TaskInventory.Values)
AddUser (item.CreatorID, item.CreatorData);
}
}
示例6: CrossPrimGroupIntoNewRegion
/// <summary>
/// Move the given scene object into a new region
/// </summary>
/// <param name="destination"></param>
/// <param name="grp">Scene Object Group that we're crossing</param>
/// <param name="attemptedPos"></param>
/// <returns>
/// true if the crossing itself was successful, false on failure
/// </returns>
protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, ISceneEntity grp, Vector3 attemptedPos)
{
bool successYN = false;
if (destination != null)
{
if (grp.SitTargetAvatar.Count != 0)
{
foreach (UUID avID in grp.SitTargetAvatar)
{
IScenePresence SP = grp.Scene.GetScenePresence(avID);
SP.Velocity = grp.RootChild.PhysActor.Velocity;
InternalCross(SP, attemptedPos, false, destination);
}
foreach (ISceneChildEntity part in grp.ChildrenEntities())
part.SitTargetAvatar = new List<UUID>();
IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
return backup.DeleteSceneObjects(new[] {grp}, false, false);
return true; //They do all the work adding the prim in the other region
}
ISceneEntity copiedGroup = grp.Copy(false);
copiedGroup.SetAbsolutePosition(true, attemptedPos);
if (grp.Scene != null)
successYN = grp.Scene.RequestModuleInterface<ISimulationService>()
.CreateObject(destination, copiedGroup);
if (successYN)
{
// We remove the object here
try
{
IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
return backup.DeleteSceneObjects(new[] {grp}, false, true);
}
catch (Exception e)
{
MainConsole.Instance.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
grp, e);
}
}
else
{
if (!grp.IsDeleted)
{
if (grp.RootChild.PhysActor != null)
{
grp.RootChild.PhysActor.CrossingFailure();
}
}
MainConsole.Instance.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
}
}
else
{
MainConsole.Instance.Error(
"[ENTITY TRANSFER MODULE]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
}
return successYN;
}
示例7: LinkPartToSOG
public bool LinkPartToSOG(ISceneEntity grp, ISceneChildEntity part, int linkNum)
{
part.SetParentLocalId(grp.RootChild.LocalId);
part.SetParent(grp);
// Insert in terms of link numbers, the new links
// before the current ones (with the exception of
// the root prim. Shuffle the old ones up
foreach (ISceneChildEntity otherPart in grp.ChildrenEntities())
{
if (otherPart.LinkNum >= linkNum)
{
// Don't update root prim link number
otherPart.LinkNum += 1;
}
}
part.LinkNum = linkNum;
return LinkPartToEntity(grp, part);
}
示例8: OnObjectBeingAddedToScene
protected void OnObjectBeingAddedToScene(ISceneEntity obj)
{
lock (m_objectsLock)
{
foreach (ISceneChildEntity child in obj.ChildrenEntities())
{
bool physicalStatus = (child.Flags & PrimFlags.Physics) == PrimFlags.Physics;
if (!m_lastAddedPhysicalStatus.ContainsKey(child.UUID))
{
m_objects++;
//Check physical status now
if (physicalStatus)
m_activeObjects++;
//Add it to the list so that we have a record of it
m_lastAddedPhysicalStatus.Add(child.UUID, physicalStatus);
}
else
{
//Its a dupe! Its a dupe!
// Check that the physical status has changed
if (physicalStatus != m_lastAddedPhysicalStatus[child.UUID])
{
//It changed... fix the count
if (physicalStatus)
m_activeObjects++;
else
m_activeObjects--;
//Update the cache
m_lastAddedPhysicalStatus[child.UUID] = physicalStatus;
}
}
}
}
}
示例9: OnObjectBeingRemovedFromScene
protected void OnObjectBeingRemovedFromScene(ISceneEntity obj)
{
lock (m_objectsLock)
{
foreach (ISceneChildEntity child in obj.ChildrenEntities())
{
bool physicalStatus = (child.Flags & PrimFlags.Physics) == PrimFlags.Physics;
if (m_lastAddedPhysicalStatus.ContainsKey(child.UUID))
{
m_objects--;
//Check physical status now and remove if necessary
if (physicalStatus)
m_activeObjects--;
//Remove our record of it
m_lastAddedPhysicalStatus.Remove(child.UUID);
}
}
}
}
示例10: SelectObject
private void SelectObject(ISceneEntity obj, bool IsNowSelected)
{
if (obj.IsAttachment)
return;
if (((obj.RootChild.Flags & PrimFlags.TemporaryOnRez) != 0))
return;
Vector3 pos = obj.AbsolutePosition;
ILandObject landObject = m_Scene.RequestModuleInterface<IParcelManagementModule>().GetLandObject(pos.X,
pos.Y);
LandData landData = landObject.LandData;
ParcelCounts parcelCounts;
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
{
int partCount = obj.ChildrenEntities().Count;
if (IsNowSelected)
parcelCounts.Selected += partCount;
else
parcelCounts.Selected -= partCount;
}
}
示例11: ResetEntityIDs
/// <summary>
/// Reset all of the UUID's, localID's, etc in this group (includes children)
/// </summary>
/// <param name="entity"></param>
private void ResetEntityIDs (ISceneEntity entity)
{
List<ISceneChildEntity> children = entity.ChildrenEntities ();
//Sort so that we rebuild in the same order and the root being first
children.Sort(LinkSetSorter);
entity.ClearChildren();
IComponentManager manager = m_parentScene.RequestModuleInterface<IComponentManager> ();
foreach (ISceneChildEntity child in children)
{
UUID oldID = child.UUID;
child.ResetEntityIDs();
entity.AddChild (child, child.LinkNum);
if (manager != null)
manager.ResetComponentIDsToNewObject (oldID, child);
}
}
示例12: StoreObject
public void StoreObject(ISceneEntity obj, UUID regionUUID)
{
uint flags = obj.RootChild.GetEffectiveObjectFlags ();
// Eligibility check
//
if ((flags & (uint)PrimFlags.Temporary) != 0)
return;
if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
return;
foreach (ISceneChildEntity prim in obj.ChildrenEntities ())
{
GD.Replace (m_primsRealm, new string[] {
"UUID", "CreationDate",
"Name", "Text", "Description",
"SitName", "TouchName", "ObjectFlags",
"OwnerMask", "NextOwnerMask", "GroupMask",
"EveryoneMask", "BaseMask", "PositionX",
"PositionY", "PositionZ", "GroupPositionX",
"GroupPositionY", "GroupPositionZ", "VelocityX",
"VelocityY", "VelocityZ", "AngularVelocityX",
"AngularVelocityY", "AngularVelocityZ",
"AccelerationX", "AccelerationY",
"AccelerationZ", "RotationX",
"RotationY", "RotationZ",
"RotationW", "SitTargetOffsetX",
"SitTargetOffsetY", "SitTargetOffsetZ",
"SitTargetOrientW", "SitTargetOrientX",
"SitTargetOrientY", "SitTargetOrientZ",
"RegionUUID", "CreatorID",
"OwnerID", "GroupID",
"LastOwnerID", "SceneGroupID",
"PayPrice", "PayButton1",
"PayButton2", "PayButton3",
"PayButton4", "LoopedSound",
"LoopedSoundGain", "TextureAnimation",
"OmegaX", "OmegaY", "OmegaZ",
"CameraEyeOffsetX", "CameraEyeOffsetY",
"CameraEyeOffsetZ", "CameraAtOffsetX",
"CameraAtOffsetY", "CameraAtOffsetZ",
"ForceMouselook", "ScriptAccessPin",
"AllowedDrop", "DieAtEdge",
"SalePrice", "SaleType",
"ColorR", "ColorG", "ColorB", "ColorA",
"ParticleSystem", "ClickAction", "Material",
"CollisionSound", "CollisionSoundVolume",
"PassTouches",
"LinkNumber", "MediaURL", "Generic" }, new object[]
{
prim.UUID.ToString(),
prim.CreationDate,
prim.Name,
prim.Text, prim.Description,
prim.SitName, prim.TouchName, (uint)prim.Flags, prim.OwnerMask, prim.NextOwnerMask, prim.GroupMask,
prim.EveryoneMask, prim.BaseMask, (double)prim.AbsolutePosition.X, (double)prim.AbsolutePosition.Y, (double)prim.AbsolutePosition.Z,
(double)prim.GroupPosition.X, (double)prim.GroupPosition.Y, (double)prim.GroupPosition.Z, (double)prim.Velocity.X, (double)prim.Velocity.Y,
(double)prim.Velocity.Z, (double)prim.AngularVelocity.X, (double)prim.AngularVelocity.Y, (double)prim.AngularVelocity.Z, (double)prim.Acceleration.X,
(double)prim.Acceleration.Y, (double)prim.Acceleration.Z, (double)prim.Rotation.X, (double)prim.Rotation.Y, (double)prim.Rotation.Z, (double)prim.Rotation.W,
(double)prim.SitTargetPosition.X, (double)prim.SitTargetPosition.Y, (double)prim.SitTargetPosition.Z, (double)prim.SitTargetOrientation.W,
(double)prim.SitTargetOrientation.X, (double)prim.SitTargetOrientation.Y, (double)prim.SitTargetOrientation.Z, regionUUID, prim.CreatorID, prim.OwnerID,
prim.GroupID, prim.LastOwnerID, obj.UUID, prim.PayPrice[0], prim.PayPrice[1], prim.PayPrice[2], prim.PayPrice[3], prim.PayPrice[4],
((prim.SoundFlags & 1) == 1) ? prim.Sound : UUID.Zero, ((prim.SoundFlags & 1) == 1) ? prim.SoundGain : 0, prim.TextureAnimation, (double)prim.AngularVelocity.X,
(double)prim.AngularVelocity.Y, (double)prim.AngularVelocity.Z, (double)prim.CameraEyeOffset.X, (double)prim.CameraEyeOffset.Y, (double)prim.CameraEyeOffset.Z,
(double)prim.CameraEyeOffset.X, (double)prim.CameraEyeOffset.Y, (double)prim.CameraEyeOffset.Z, prim.ForceMouselook ? 1 : 0, prim.ScriptAccessPin,
prim.AllowedDrop ? 1 : 0, prim.DIE_AT_EDGE ? 1 : 0, prim.SalePrice, unchecked((sbyte)(prim.ObjectSaleType)), prim.Color.R, prim.Color.G, prim.Color.B,
prim.Color.A, prim.ParticleSystem, unchecked((sbyte)(prim.ClickAction)), unchecked((sbyte)(prim.Material)), prim.CollisionSound, prim.CollisionSoundVolume,
prim.PassTouch, prim.LinkNum, prim.MediaUrl, prim.GenericData
});
GD.Replace (m_primShapesRealm, new string[] {
"UUID", "Shape", "ScaleX", "ScaleY",
"ScaleZ", "PCode", "PathBegin", "PathEnd",
"PathScaleX", "PathScaleY", "PathShearX",
"PathShearY", "PathSkew", "PathCurve",
"PathRadiusOffset", "PathRevolutions",
"PathTaperX", "PathTaperY", "PathTwist",
"PathTwistBegin", "ProfileBegin", "ProfileEnd",
"ProfileCurve", "ProfileHollow", "Texture",
"ExtraParams", "State", "Media" },
new object[] {
prim.UUID, 0, (double)prim.Shape.Scale.X, (double)prim.Shape.Scale.Y, (double)prim.Shape.Scale.Z,
prim.Shape.PCode, prim.Shape.PathBegin, prim.Shape.PathEnd, prim.Shape.PathScaleX, prim.Shape.PathScaleY,
prim.Shape.PathShearX, prim.Shape.PathShearY, prim.Shape.PathSkew, prim.Shape.PathCurve, prim.Shape.PathRadiusOffset,
prim.Shape.PathRevolutions, prim.Shape.PathTaperX, prim.Shape.PathTaperY, prim.Shape.PathTwist, prim.Shape.PathTwistBegin,
prim.Shape.ProfileBegin, prim.Shape.ProfileEnd, prim.Shape.ProfileCurve, prim.Shape.ProfileHollow, prim.Shape.TextureEntry,
prim.Shape.ExtraParams, prim.Shape.State, null == prim.Shape.Media ? null : prim.Shape.Media.ToXml()
});
}
}
示例13: FireDeadAvatarEvent
private void FireDeadAvatarEvent (string KillerName, IScenePresence DeadAv, ISceneEntity killer)
{
IScriptModule[] scriptEngines = DeadAv.Scene.RequestModuleInterfaces<IScriptModule>();
foreach (IScriptModule m in scriptEngines)
{
if (killer != null)
{
foreach (ISceneChildEntity part in killer.ChildrenEntities())
{
m.PostObjectEvent(part.UUID, "dead_avatar", new object[] { DeadAv.Name, KillerName, DeadAv.UUID });
}
foreach (UUID primID in m_combatModule.PrimCombatServers)
{
m.PostObjectEvent(primID, "dead_avatar", new object[] { DeadAv.Name, KillerName, DeadAv.UUID });
}
}
}
}
示例14: RemoveObject
// NOTE: Call under Taint Lock
private void RemoveObject(ISceneEntity obj)
{
if (obj.IsAttachment)
return;
if (((obj.RootChild.Flags & PrimFlags.TemporaryOnRez) != 0))
return;
Vector3 pos = obj.AbsolutePosition;
ILandObject landObject = m_Scene.RequestModuleInterface<IParcelManagementModule>().GetLandObject(pos.X, pos.Y);
if (landObject == null)
landObject = m_Scene.RequestModuleInterface<IParcelManagementModule>().GetNearestAllowedParcel(UUID.Zero, pos.X, pos.Y);
if (landObject == null)
return;
LandData landData = landObject.LandData;
ParcelCounts parcelCounts;
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
{
UUID landOwner = landData.OwnerID;
foreach (ISceneChildEntity child in obj.ChildrenEntities())
{
if (!parcelCounts.Objects.ContainsKey(child.UUID))
{
//Well... now what?
}
else
{
parcelCounts.Objects.Remove(child.UUID);
if (m_SimwideCounts.ContainsKey(landOwner))
m_SimwideCounts[landOwner] -= 1;
if (parcelCounts.Users.ContainsKey(obj.OwnerID))
parcelCounts.Users[obj.OwnerID] -= 1;
if (landData.IsGroupOwned)
{
if (obj.OwnerID == landData.GroupID)
parcelCounts.Owner -= 1;
else if (obj.GroupID == landData.GroupID)
parcelCounts.Group -= 1;
else
parcelCounts.Others -= 1;
}
else
{
if (obj.OwnerID == landData.OwnerID)
parcelCounts.Owner -= 1;
else if (obj.GroupID == landData.GroupID)
parcelCounts.Group -= 1;
else
parcelCounts.Others -= 1;
}
}
}
}
}
示例15: FindAttachmentPoint
//.........这里部分代码省略.........
}
}
group.HasGroupChanged = changedPositionPoint;
//Update where we are put
group.SetAttachmentPoint((byte)AttachmentPt);
//Fix the position with the one we found
group.AbsolutePosition = attachPos;
// Remove any previous attachments
IScenePresence presence = m_scene.GetScenePresence (remoteClient.AgentId);
if (presence == null)
return;
UUID itemID = UUID.Zero;
//Check for multiple attachment bits and whether we should remove the old
if(!hasMultipleAttachmentsSet)
{
foreach (ISceneEntity grp in attachments)
{
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
{
itemID = grp.RootChild.FromUserInventoryItemID;
break;
}
}
if (itemID != UUID.Zero)
DetachSingleAttachmentToInventory(itemID, remoteClient);
}
itemID = group.RootChild.FromUserInventoryItemID;
group.RootChild.AttachedAvatar = presence.UUID;
List<ISceneChildEntity> parts = group.ChildrenEntities();
for (int i = 0; i < parts.Count; i++)
parts[i].AttachedAvatar = presence.UUID;
if (group.RootChild.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim (group.RootChild.PhysActor);
group.RootChild.PhysActor = null;
}
group.RootChild.AttachedPos = attachPos;
group.RootChild.IsAttachment = true;
group.AbsolutePosition = attachPos;
group.RootChild.SetParentLocalId (presence.LocalId);
group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
AvatarAttachments attPlugin = presence.RequestModuleInterface<AvatarAttachments>();
if (attPlugin != null)
{
attPlugin.AddAttachment (group);
presence.AddAttachment (group);
}
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (group.IsSelected)
{
foreach (ISceneChildEntity part in group.ChildrenEntities())
{
part.CreateSelected = true;