本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.GetChildPart方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.GetChildPart方法的具体用法?C# SceneObjectGroup.GetChildPart怎么用?C# SceneObjectGroup.GetChildPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.GetChildPart方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEntity
public SceneObjectGroup CreateEntity(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
{
m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
return null;
}
SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
// if grass or tree, make phantom
//rootPart.TrimPermissions();
rootPart.AddFlag(PrimFlags.Phantom);
if (rootPart.Shape.PCode != (byte)PCode.Grass)
AdaptTree(ref shape);
m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
return sceneObject;
}
示例2: RezPrim
public virtual SceneObjectGroup RezPrim(SceneObjectPart sourcePart, SceneObjectPart newPart, int param, out string reason)
{
// Rez object
Vector3 pos = newPart.AbsolutePosition;
SceneObjectGroup group = new SceneObjectGroup(newPart);
bool isTemp = (group.RootPart.GetEffectiveObjectFlags() & PrimFlags.TemporaryOnRez) != 0;
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
if (parcel == null)
{
reason = "land";
return null;
}
// Pass 0 for landImpact here so that it can be tested separately.
if (!Permissions.CanRezObject(0, newPart.OwnerID, sourcePart.UUID, pos, isTemp))
{
reason = "permission";
return null;
}
if (!CheckLandImpact(parcel, group.LandImpact, out reason))
{
return null;
}
// Check for grey goo fence
if (!CheckGreyGoo(sourcePart, group))
{
reason = "fence";
return null;
}
// Allowing the rez... update the last rez time and the new group fields
sourcePart.StampLastRez();
group.CurrentParcel = parcel; // initialize _currentParcel (and auto-return)
group.SetGeneration(group.RootPart.Generation); // now update the rest of the parts
group.ResetIDs();
//set the group's group before setting the object's position.
//this will make sure that the group id is correct during the script
//engine's group check
group.SetGroup(sourcePart.ParentGroup.RootPart.GroupID, null);
AddNewSceneObject(group, !isTemp);
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.TrimPermissions();
if (group.RootPart.IsPrim)
{
group.ClearPartAttachmentData();
}
group.CreateScriptInstances(param, ScriptStartFlags.PostOnRez, DefaultScriptEngine, (int)ScriptStateSource.PrimData, null);
rootPart.ScheduleFullUpdate(PrimUpdateFlags.ForcedFullUpdate);
reason = "success";
return rootPart.ParentGroup;
}
示例3: RezSingleObjectToWorld
private SceneObjectGroup RezSingleObjectToWorld(IClientAPI remoteClient, UUID itemID,
SceneObjectGroup group, Vector3 RayEnd, Vector3 RayStart,
UUID RayTargetID, byte BypassRayCast, byte bRayEndIsIntersection,
bool RezSelected, bool attachment, Vector3 pos, string name,
string description, IInventoryItem item, ItemPermissionBlock itemPermissions,
int? startParam, UUID? newAvatarGroupId, UUID? rezzedByObjectUUID)
{
bool ownerChanged = false; // record this for the CHANGED_OWNER changed event
if (IsBadUserLoad(group))
{
if (remoteClient != null)
remoteClient.SendAgentAlertMessage("You are currently not allowed to rez objects in this region.", false);
return null; // already reported above
}
if (IsBlacklistedLoad(group))
{
if (remoteClient != null)
remoteClient.SendAgentAlertMessage("Cannot rez blacklisted object '" + group.Name + "'.", false);
return null; // already reported above
}
//set the group here so that positioning in world will enable/disable the
//script correctly based on the group the use is currently in
// Initialize the server weight (LI)
group.RecalcPrimWeights();
group.RezzedFromFolderId = item.Folder;
//group.FromAssetId = item.AssetID; //not needed yet
if (newAvatarGroupId.HasValue)
{
//set the object's land group
group.SetGroup(newAvatarGroupId.Value, null);
}
if (attachment)
{
group.SetFromItemID(itemID);
}
else
{
group.RootPart.SetGroupPositionDirect(pos);
if (RezSelected)
{
//also tell the client there is a new object being rezzed
foreach (SceneObjectPart part in group.GetParts())
{
part.AddFlag(PrimFlags.CreateSelected);
}
}
}
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
if (rootPart == null) {
string what = "object ";
if (attachment)
what = " attachment ";
m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + what + " root part not found.");
return null;
}
// 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.
rootPart.Name = name;
rootPart.Description = description;
var partList = group.GetParts();
foreach (SceneObjectPart part in partList)
{
/// This fixes inconsistencies between this part and the root part.
/// In the past, there was a bug in Link operations that did not force
/// these permissions on child prims when linking.
part.SyncChildPermsWithRoot();
}
if (rootPart.OwnerID != item.Owner)
{
if (Permissions.PropagatePermissions())
{
if ((itemPermissions.CurrentPermissions & ScenePermBits.SLAM) != 0)
{ // enforce slam bit, apply item perms to the group parts
foreach (SceneObjectPart part in partList)
{
part.EveryoneMask = item.EveryOnePermissions;
part.NextOwnerMask = item.NextPermissions;
part.GroupMask = 0; // DO NOT propagate here
}
}
group.ApplyNextOwnerPermissions();
}
}
ownerChanged |= group.Rationalize(item.Owner, false);
foreach (SceneObjectPart part in partList)
//.........这里部分代码省略.........
示例4: CreateEntity
public SceneObjectGroup CreateEntity(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
{
m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
return null;
}
SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape, m_scene);
SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
rootPart.AddFlag(PrimFlags.Phantom);
if (rootPart.Shape.PCode != (byte)PCode.Grass)
{
// Tree size has to be adapted depending on its type
switch ((Tree)rootPart.Shape.State)
{
case Tree.Cypress1:
case Tree.Cypress2:
case Tree.Palm1:
case Tree.Palm2:
case Tree.WinterAspen:
rootPart.Scale = new Vector3(4, 4, 10);
break;
case Tree.WinterPine1:
case Tree.WinterPine2:
rootPart.Scale = new Vector3(4, 4, 20);
break;
case Tree.Dogwood:
rootPart.Scale = new Vector3(6.5f, 6.5f, 6.5f);
break;
// case... other tree types
// tree.Scale = new Vector3(?, ?, ?);
// break;
default:
rootPart.Scale = new Vector3(4, 4, 4);
break;
}
}
m_scene.AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupForFullUpdate(PrimUpdateFlags.FullUpdate);
sceneObject.SetGroup(groupID, null);
return sceneObject;
}
示例5: MarkWithDifferences
/// <summary>
/// Returns true if there was a change between meta entity and the entity group, false otherwise.
/// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated).
/// </summary>
public bool MarkWithDifferences(SceneObjectGroup sceneEntityGroup)
{
SceneObjectPart sceneEntityPart;
SceneObjectPart metaEntityPart;
Diff differences;
bool changed = false;
// Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
// had originally saved.
// m_Entity will NOT necessarily be the same entity as the user had saved.
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Parts)
{
//This is the part that we use to show changes.
metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
if (sceneEntityGroup.ContainsPart(UnchangedPart.UUID))
{
sceneEntityPart = sceneEntityGroup.GetChildPart(UnchangedPart.UUID);
differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
if (differences != Diff.NONE)
metaEntityPart.Text = "CHANGE: " + differences.ToString();
if (differences != 0)
{
// Root Part that has been modified
if ((differences & Diff.POSITION) > 0)
{
// If the position of any part has changed, make sure the RootPart of the
// meta entity is pointing with a beam particle system
if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
{
m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
}
BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
m_UnchangedEntity.RootPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
sceneEntityPart,
new Vector3(0, 0, 254)
);
m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
}
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(0, 0, 254),
UnchangedPart.Scale
);
m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
DiffersFromSceneGroup = true;
}
else // no differences between scene part and meta part
{
if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
{
m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
}
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
SetPartTransparency(metaEntityPart, MetaEntity.NONE);
}
}
else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
{
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(254, 0, 0),
UnchangedPart.Scale
);
m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
DiffersFromSceneGroup = true;
}
}
return changed;
}
示例6: CreateEntity
public SceneObjectGroup CreateEntity(UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
{
m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
return null;
}
SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
rootPart.AddFlag(PrimFlags.Phantom);
m_scene.AddNewSceneObject(sceneObject, false);
sceneObject.SetGroup(groupID, null);
return sceneObject;
}