本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.Rationalize方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.Rationalize方法的具体用法?C# SceneObjectGroup.Rationalize怎么用?C# SceneObjectGroup.Rationalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.Rationalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
//.........这里部分代码省略.........
示例2: AddGroupToSceneGraph
/// <summary>
/// Add an object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene.
/// </summary>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, the object is made persistent into the scene.
/// If false, the object will not persist over server restarts
/// </param>
/// <returns>true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
public bool AddGroupToSceneGraph(SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool fromStorage,
bool fromCrossing)
{
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
{
m_log.ErrorFormat("[SceneGraph]: {0} AddGroupToSceneGraph failed, invalid or null object.", m_parentScene.RegionInfo.RegionName);
return false;
}
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
Vector3 scale = part.Shape.Scale;
if (scale.X < SceneObjectPart.MIN_PART_SCALE)
{
scale.X = SceneObjectPart.MIN_PART_SCALE;
sceneObject.HasGroupChanged = true;
}
if (scale.Y < SceneObjectPart.MIN_PART_SCALE)
{
scale.Y = SceneObjectPart.MIN_PART_SCALE;
sceneObject.HasGroupChanged = true;
}
if (scale.Z < SceneObjectPart.MIN_PART_SCALE)
{
scale.Z = SceneObjectPart.MIN_PART_SCALE;
sceneObject.HasGroupChanged = true;
}
if (m_parentScene.m_clampPrimSize)
{
if (scale.X > m_parentScene.m_maxNonphys)
scale.X = m_parentScene.m_maxNonphys;
if (scale.Y > m_parentScene.m_maxNonphys)
scale.Y = m_parentScene.m_maxNonphys;
if (scale.Z > m_parentScene.m_maxNonphys)
scale.Z = m_parentScene.m_maxNonphys;
}
part.Shape.Scale = scale;
}
// if physical, make sure we're above the ground by at least 10 cm
if ((sceneObject.RootPart.Flags & PrimFlags.Physics) != 0)
{
OpenSim.Framework.Geom.Box bbox = sceneObject.BoundingBox();
float groundHeight = m_parentScene.Heightmap.CalculateHeightAt(sceneObject.AbsolutePosition.X, sceneObject.AbsolutePosition.Y);
if (sceneObject.AbsolutePosition.Z + bbox.Size.Z <= groundHeight)
{
Vector3 newPos = sceneObject.AbsolutePosition;
newPos.Z = (bbox.Size.Z / 2.0f) + groundHeight + 0.1f;
sceneObject.RootPart.SetGroupPositionDirect(newPos);
}
AddPhysicalObject();
}
// rationalize the group: fix any inconsistency in locked bits, and
// clear the default touch action of BUY for any objects not actually for sale, etc
sceneObject.Rationalize(sceneObject.OwnerID, fromCrossing);
sceneObject.AttachToScene(m_parentScene, fromStorage); // allocates the localIds for the prims
if (!alreadyPersisted)
{
sceneObject.HasGroupChanged = true;
}
sceneObject.IsPersisted = alreadyPersisted;
lock (sceneObject)
{
bool entityAdded = false;
lock (m_dictionary_lock)
{
if (!Entities.ContainsKey(sceneObject.LocalId))
{
Entities.Add(sceneObject);
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
SceneObjectPartsByFullID[part.UUID] = part;
SceneObjectPartsByLocalID[part.LocalId] = part;
}
entityAdded = true;
}
}
if (entityAdded)
{
m_numPrim += sceneObject.Children.Count;
//.........这里部分代码省略.........