本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.ForceInventoryPersistence方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.ForceInventoryPersistence方法的具体用法?C# SceneObjectGroup.ForceInventoryPersistence怎么用?C# SceneObjectGroup.ForceInventoryPersistence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.ForceInventoryPersistence方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRestoredSceneObject
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <param name="sendClientUpdates">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
if (!m_parentScene.CombineRegions)
{
// temporary checks to remove after varsize suport
float regionSizeX = m_parentScene.RegionInfo.RegionSizeX;
if (regionSizeX == 0)
regionSizeX = Constants.RegionSize;
float regionSizeY = m_parentScene.RegionInfo.RegionSizeY;
if (regionSizeY == 0)
regionSizeY = Constants.RegionSize;
// KF: Check for out-of-region, move inside and make static.
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
sceneObject.RootPart.GroupPosition.Y,
sceneObject.RootPart.GroupPosition.Z);
if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 ||
npos.X > regionSizeX ||
npos.Y > regionSizeY))
{
if (npos.X < 0.0) npos.X = 1.0f;
if (npos.Y < 0.0) npos.Y = 1.0f;
if (npos.Z < 0.0) npos.Z = 0.0f;
if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
SceneObjectPart rootpart = sceneObject.RootPart;
rootpart.GroupPosition = npos;
foreach (SceneObjectPart part in sceneObject.Parts)
{
if (part == rootpart)
continue;
part.GroupPosition = npos;
}
rootpart.Velocity = Vector3.Zero;
rootpart.AngularVelocity = Vector3.Zero;
rootpart.Acceleration = Vector3.Zero;
}
}
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
if (attachToBackup && (!alreadyPersisted))
{
sceneObject.ForceInventoryPersistence();
sceneObject.HasGroupChanged = true;
}
return ret;
}
示例2: AddRestoredSceneObject
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{
if (!alreadyPersisted)
{
sceneObject.ForceInventoryPersistence();
sceneObject.HasGroupChanged = true;
}
return AddSceneObject(sceneObject, attachToBackup, true);
}
示例3: AddNewSceneObject
/// <summary>
/// Add a newly created 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>
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
// Ensure that we persist this new scene object
sceneObject.HasGroupChanged = true;
sceneObject.ForceInventoryPersistence();
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
}