本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.ScheduleGroupUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.ScheduleGroupUpdate方法的具体用法?C# SceneObjectGroup.ScheduleGroupUpdate怎么用?C# SceneObjectGroup.ScheduleGroupUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.ScheduleGroupUpdate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CrossGroupToNewRegion
/// <summary>
/// Move the given scene object into a new region depending on which region its absolute position has moved
/// into.
///
/// This method locates the new region handle and offsets the prim position for the new region
/// </summary>
/// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
/// <param name="grp">the scene object that we're crossing</param>
///<param name="destination"></param>
public bool CrossGroupToNewRegion(SceneObjectGroup grp, Vector3 attemptedPosition, GridRegion destination)
{
if (grp == null)
return false;
if (grp.IsDeleted)
return false;
if (grp.Scene == null)
return false;
if (grp.RootPart.DIE_AT_EDGE)
{
// We remove the object here
try
{
IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
return backup.DeleteSceneObjects(new[] { grp }, true, true);
}
catch (Exception)
{
MainConsole.Instance.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
}
return false;
}
if (grp.RootPart.RETURN_AT_EDGE)
{
// We remove the object here
try
{
List<ISceneEntity> objects = new List<ISceneEntity> { grp };
ILLClientInventory inventoryModule = grp.Scene.RequestModuleInterface<ILLClientInventory>();
if (inventoryModule != null)
return inventoryModule.ReturnObjects(objects.ToArray(), UUID.Zero);
}
catch (Exception)
{
MainConsole.Instance.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
}
return false;
}
Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
// If we fail to cross the border, then reset the position of the scene object on that border.
if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, attemptedPosition))
{
grp.OffsetForNewRegion(oldGroupPosition);
grp.ScheduleGroupUpdate (PrimUpdateFlags.ForcedFullUpdate);
return false;
}
return true;
}
示例2: AddSceneObject
/// <summary>
/// Adds a Scene Object group to the Scene.
/// Verifies that the creator of the object is not banned from the simulator.
/// Checks if the item is an Attachment
/// </summary>
/// <param name="scene"></param>
/// <param name="sceneObject"></param>
/// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
public bool AddSceneObject(IScene scene, SceneObjectGroup sceneObject)
{
// If the user is banned, we won't let any of their objects
// enter. Period.
//
if (scene.RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
{
MainConsole.Instance.Info("[EntityTransferModule]: Denied prim crossing for banned avatar");
return false;
}
if (!sceneObject.IsAttachmentCheckFull()) // Not Attachment
{
if (!scene.Permissions.CanObjectEntry(sceneObject.UUID,
true, sceneObject.AbsolutePosition, sceneObject.OwnerID))
{
// Deny non attachments based on parcel settings
//
MainConsole.Instance.Info("[EntityTransferModule]: Denied prim crossing " +
"because of parcel settings");
IBackupModule backup = scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
backup.DeleteSceneObjects(new[] { sceneObject }, true, true);
return false;
}
if (scene.SceneGraph.AddPrimToScene(sceneObject))
{
if(sceneObject.RootPart.IsSelected)
sceneObject.RootPart.CreateSelected = true;
sceneObject.ScheduleGroupUpdate (PrimUpdateFlags.ForcedFullUpdate);
return true;
}
}
return false;
}
示例3: AddNewPrim
/// <summary>
/// Create a New SceneObjectGroup/Part by raycasting
/// </summary>
/// <param name="ownerID"></param>
/// <param name="groupID"></param>
/// <param name="RayEnd"></param>
/// <param name="rot"></param>
/// <param name="shape"></param>
/// <param name="bypassRaycast"></param>
/// <param name="RayStart"></param>
/// <param name="RayTargetID"></param>
/// <param name="RayEndIsIntersection"></param>
public virtual ISceneEntity AddNewPrim(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
//m_log.DebugFormat(
// "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
SceneObjectGroup sceneObject = new SceneObjectGroup (ownerID, pos, rot, shape, m_DefaultObjectName, m_parentScene);
// If an entity creator has been registered for this prim type then use that
if (m_entityCreators.ContainsKey((PCode)shape.PCode))
{
sceneObject = (SceneObjectGroup)m_entityCreators[(PCode)shape.PCode].CreateEntity (sceneObject, ownerID, groupID, pos, rot, shape);
}
else
{
// Otherwise, use this default creation code;
sceneObject.SetGroup(groupID, null);
AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
}
return sceneObject;
}
示例4: DoAutoPilot
public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
{
m_autopilotMoving = true;
m_autoPilotTarget = Pos;
m_sitAtAutoTarget = false;
PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
//proxy.PCode = (byte)PCode.ParticleSystem;
proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy, "", m_scene);
proxyObjectGroup.AttachToScene(m_scene);
// Commented out this code since it could never have executed, but might still be informative.
// if (proxyObjectGroup != null)
// {
proxyObjectGroup.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
IBackupModule backup = m_scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
backup.DeleteSceneObjects(new[] { proxyObjectGroup }, true, true);
// }
// else
// {
// m_autopilotMoving = false;
// m_autoPilotTarget = Vector3.Zero;
// ControllingClient.SendAlertMessage("Autopilot cancelled");
// }
}
示例5: AddNewPrim
/// <summary>
/// Create a New SceneObjectGroup/Part by raycasting
/// </summary>
/// <param name="ownerID"></param>
/// <param name="groupID"></param>
/// <param name="RayEnd"></param>
/// <param name="rot"></param>
/// <param name="shape"></param>
/// <param name="bypassRaycast"></param>
/// <param name="RayStart"></param>
/// <param name="RayTargetID"></param>
/// <param name="RayEndIsIntersection"></param>
public virtual SceneObjectGroup AddNewPrim(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
//m_log.DebugFormat(
// "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
SceneObjectGroup sceneObject = null;
// If an entity creator has been registered for this prim type then use that
if (m_entityCreators.ContainsKey((PCode)shape.PCode))
{
sceneObject = (SceneObjectGroup)m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape);
}
else
{
// Otherwise, use this default creation code;
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape, m_parentScene);
//This has to be set, otherwise it will break things like rezzing objects in an area where crossing is disabled, but rez isn't
sceneObject.m_lastSignificantPosition = pos;
sceneObject.SetGroup(groupID, null);
AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
}
return sceneObject;
}
示例6: FindAttachmentPoint
//.........这里部分代码省略.........
if (itemID != UUID.Zero)
DetachSingleAttachmentToInventory(itemID, remoteClient);
}
itemID = group.GetFromItemID();
group.RootPart.AttachedAvatar = presence.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = group.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = presence.UUID;
if (group.RootPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(group.RootPart.PhysActor);
group.RootPart.PhysActor = null;
}
group.AbsolutePosition = attachPos;
group.RootPart.AttachedPos = attachPos;
group.RootPart.IsAttachment = true;
group.RootPart.SetParentLocalId(presence.LocalId);
group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
AvatarAttachments attPlugin = presence.RequestModuleInterface<AvatarAttachments>();
if (attPlugin != null)
attPlugin.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 (SceneObjectPart part in group.ChildrenList)
{
part.CreateSelected = true;
}
}
//Kill the previous entity so that it will be selected
SendKillEntity(group.RootPart);
//NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
// So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
group.IsSelected = false;
if (itemID == UUID.Zero)
{
//Delete the object inworld to inventory
List<SceneObjectGroup> groups = new List<SceneObjectGroup>(1) { group };
IInventoryAccessModule inventoryAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (inventoryAccess != null)
inventoryAccess.DeleteToInventory(DeRezAction.AcquireToUserInventory, UUID.Zero,
groups, remoteClient.AgentId, out itemID);
}
else
{
//it came from an item, we need to start the scripts
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
group.CreateScriptInstances(0, true, 4, UUID.Zero);
group.ResumeScripts();
}
if (UUID.Zero == itemID)
{
m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error inventory item ID.");
remoteClient.SendAgentAlertMessage(
"Unable to save attachment. Error inventory item ID.", false);
return;
}
// XXYY!!
if (item == null)
{
item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
}
//Update the ItemID with the new item
group.SetFromItemID(item.ID);
//If we updated the attachment, we need to save the change
if (presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID))
AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
//Now recreate it so that it is selected
group.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
// In case it is later dropped again, don't let
// it get cleaned up
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
m_scene.EventManager.TriggerOnAttach(localID, group.GetFromItemID(), remoteClient.AgentId);
}
示例7: CreateEntity
public ISceneEntity 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.SceneGraph.AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
sceneObject.SetGroup(groupID, null);
return sceneObject;
}
示例8: AttachToAgent
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
///
/// This isn't publicly available since attachments should always perform the corresponding inventory
/// operation (to show the attach in user inventory and update the asset with positional information).
///
/// <param name="sp"></param>
/// <param name="so"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
/// <param name="silent"></param>
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
// Remove from database and parcel prim count
IBackupModule backup = so.Scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
backup.DeleteFromStorage(so.UUID);
so.RootPart.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = so.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = AttachOffset;
so.RootPart.AttachedPos = AttachOffset;
so.RootPart.IsAttachment = true;
so.RootPart.SetParentLocalId(avatar.LocalId);
so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
avatar.AddAttachment(so);
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.ForEachClient(delegate(IClientAPI client)
{
client.SendKillObject(m_scene.RegionInfo.RegionHandle, new ISceneEntity[] { so.RootPart });
});
foreach (SceneObjectPart part in so.ChildrenList)
{
part.CreateSelected = true;
}
}
//NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
// So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
so.IsSelected = false;
so.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
// In case it is later dropped again, don't let
// it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.HasGroupChanged = false;
}
示例9: AddNewPrim
/// <summary>
/// Create a New SceneObjectGroup/Part by raycasting
/// </summary>
/// <param name="ownerID"></param>
/// <param name="groupID"></param>
/// <param name="pos"></param>
/// <param name="rot"></param>
/// <param name="shape"></param>
public virtual ISceneEntity AddNewPrim(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
SceneObjectGroup sceneObject = new SceneObjectGroup (ownerID, pos, rot, shape, m_DefaultObjectName, m_parentScene);
// If an entity creator has been registered for this prim type then use that
if (m_entityCreators.ContainsKey((PCode)shape.PCode))
{
sceneObject = (SceneObjectGroup)m_entityCreators[(PCode)shape.PCode].CreateEntity (sceneObject, ownerID, groupID, pos, rot, shape);
}
else
{
// Otherwise, use this default creation code;
sceneObject.SetGroup(groupID, ownerID, false);
AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
}
return sceneObject;
}