本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectPart.SetParentLocalId方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectPart.SetParentLocalId方法的具体用法?C# SceneObjectPart.SetParentLocalId怎么用?C# SceneObjectPart.SetParentLocalId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectPart
的用法示例。
在下文中一共展示了SceneObjectPart.SetParentLocalId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRootPart
/// <summary>
/// Set a part to act as the root part for this scene object
/// </summary>
/// <param name="part"></param>
public void SetRootPart(SceneObjectPart part)
{
if (part == null)
throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart");
m_rootPart = part;
if (!IsAttachment)
part.SetParentLocalId(0);
AddChild(part, part.LinkNum);
}
示例2: DelinkFromGroup
/// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
{
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
Quaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object
m_scene.SceneGraph.DeLinkPartFromEntity(this, linkPart);
/* this is already done in DeLinkPartFromEntity
if (m_partsList.Count == 1 && RootPart != null) //Single prim is left
RootPart.LinkNum = 0;
else
{
lock (m_partsLock)
{
foreach (SceneObjectPart p in m_partsList)
{
if (p.LinkNum > linkPart.LinkNum)
p.LinkNum--;
}
}
}
*/
linkPart.SetParentLocalId(0);
linkPart.LinkNum = 0;
if (linkPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(linkPart.PhysActor);
// linkPart.PhysActor.delink();
}
// We need to reset the child part's position
// ready for life as a separate object after being a part of another object
Quaternion parentRot = m_rootPart.RotationOffset;
Vector3 axPos = linkPart.OffsetPosition;
axPos *= parentRot;
linkPart.SetOffsetPosition(axPos);
linkPart.FixGroupPosition(AbsolutePosition + linkPart.OffsetPosition,false);
linkPart.FixOffsetPosition(Vector3.Zero, false);
linkPart.RotationOffset = worldRot;
SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart, Scene);
m_scene.SceneGraph.DelinkPartToScene(objectGroup);
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
linkPart.Rezzed = RootPart.Rezzed;
//This is already set multiple places, no need to do it again
//HasGroupChanged = true;
//We need to send this so that we don't have issues with the client not realizing that the prims were unlinked
ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
return objectGroup;
}
示例3: SetPropertyValue
/// <summary>
/// Set the property's value based on the value maintained in SyncInfoManager.
/// Assumption: caller will call ScheduleFullUpdate to enqueue updates properly to
/// update viewers.
/// This function should only be triggered when a prim update is received (i.e.
/// triggered by remote update instead of local update).
/// </summary>
/// <param name="part"></param>
/// <param name="property"></param>
///
/*
private void SetPropertyValue(SceneObjectPart part, SyncedProperty syncedProperty)
{
//DebugLog.WarnFormat("[SYNC INFO PRIM] SetPropertyValue(part={0}, property={1})", part.UUID, property.ToString());
if (part == null)
return;
SyncableProperties.Type property = syncedProperty.Property;
// If this is a physical property but the part's PhysActor is null, then we can't set it.
if (SyncableProperties.PhysActorProperties.Contains(property) && syncedProperty == null && part.PhysActor == null)
{
// DebugLog.WarnFormat("{0}: SetPropertyValue: property {1} not in record.", LogHeader, property.ToString());
//For phantom prims, they don't have physActor properties, so for those properties, simply return
return;
}
if (syncedProperty == null)
{
DebugLog.ErrorFormat("{0}: SetPropertyValue: property {1} not in sync cache for uuid {2}. CSP.Count={3} ", LogHeader, property, UUID, CurrentlySyncedProperties.Count);
return;
}
SetPropertyValue(part, property, syncedProperty);
}
*/
private void SetPropertyValue(SceneObjectPart part, SyncedProperty pSyncInfo)
{
if (part == null || pSyncInfo == null)
return;
SyncableProperties.Type property = pSyncInfo.Property;
Object LastUpdateValue = pSyncInfo.LastUpdateValue;
// Do not generate undo information for this update
part.IgnoreUndoUpdate = true;
switch (property)
{
///////////////////////
//SOP properties
///////////////////////
case SyncableProperties.Type.AggregateScriptEvents:
part.AggregateScriptEvents = (scriptEvents)(int)LastUpdateValue;
//DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents);
// Have the part process the new values for collision events.
part.SubscribeForCollisionEvents();
break;
case SyncableProperties.Type.AllowedDrop:
part.AllowedDrop = (bool)LastUpdateValue;
break;
case SyncableProperties.Type.AngularVelocity:
part.AngularVelocity = (Vector3)LastUpdateValue;
break;
case SyncableProperties.Type.AttachedAvatar:
//part.AttachedAvatar = (UUID)LastUpdateValue;
UUID attachedAvatar = (UUID)LastUpdateValue;
if (part.ParentGroup != null && !part.ParentGroup.AttachedAvatar.Equals(attachedAvatar))
{
part.ParentGroup.AttachedAvatar = attachedAvatar;
if (attachedAvatar != UUID.Zero)
{
ScenePresence avatar = Scene.GetScenePresence(attachedAvatar);
//It is possible that the avatar has not been fully
//created locally when attachment objects are sync'ed.
//So we need to check if the avatar already exists.
//If not, handling of NewPresence will evetually trigger
//calling of SetParentLocalId.
if (avatar != null)
{
if (part.ParentGroup != null)
{
part.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
}
else
{
//If this SOP is not a part of group yet, record the
//avatar's localID for now. If this SOP is rootpart of
//the group, then the localID is the right setting;
//otherwise, this SOP will be linked to the SOG it belongs
//to later, and that will rewrite the parent localID.
part.SetParentLocalId(avatar.LocalId);
}
}
}
else
{
//.........这里部分代码省略.........
示例4: LinkNonRootPart
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
{
Quaternion parentRot = oldGroupRotation;
Quaternion oldRot = part.RotationOffset;
Quaternion worldRot = parentRot * oldRot;
parentRot = oldGroupRotation;
Vector3 axPos = part.OffsetPosition;
axPos *= parentRot;
part.OffsetPosition = axPos;
part.GroupPosition = oldGroupPosition + part.OffsetPosition;
part.OffsetPosition = Vector3.Zero;
part.RotationOffset = worldRot;
part.SetParent(this);
part.SetParentLocalId(m_rootPart.LocalId);
UpdatePartList(part);
part.LinkNum = linkNum;
part.OffsetPosition = part.GroupPosition - AbsolutePosition;
Quaternion rootRotation = m_rootPart.RotationOffset;
Vector3 pos = part.OffsetPosition;
pos *= Quaternion.Inverse(rootRotation);
part.OffsetPosition = pos;
parentRot = m_rootPart.RotationOffset;
oldRot = part.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
part.RotationOffset = newRot;
}
示例5: DelinkFromGroup
/// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
{
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
linkPart.ClearUndoState();
foreach (SceneObjectPart child in ChildrenList)
{
child.ClearUndoState();
}
Quaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object
RemovePartList(linkPart);
if (m_parts.Count == 1 && RootPart != null) //Single prim is left
RootPart.LinkNum = 0;
else
{
lock (m_partsLock)
{
foreach (SceneObjectPart p in m_partsList)
{
if (p.LinkNum > linkPart.LinkNum)
p.LinkNum--;
}
}
}
linkPart.SetParentLocalId(0);
linkPart.LinkNum = 0;
if (linkPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
}
// We need to reset the child part's position
// ready for life as a separate object after being a part of another object
Quaternion parentRot = m_rootPart.RotationOffset;
Vector3 axPos = linkPart.OffsetPosition;
axPos *= parentRot;
linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z);
linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition;
linkPart.OffsetPosition = new Vector3(0, 0, 0);
linkPart.RotationOffset = worldRot;
SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart, Scene);
m_scene.AddNewSceneObject(objectGroup, true);
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
linkPart.Rezzed = RootPart.Rezzed;
//HasGroupChanged = true;
//ScheduleGroupForFullUpdate();
return objectGroup;
}
示例6: SetPartAsNonRoot
/// <summary>
///
/// </summary>
/// <param name="part"></param>
private void SetPartAsNonRoot(SceneObjectPart part)
{
part.SetParentLocalId(m_rootPart.LocalId);
part.ClearUndoState();
}
示例7: LinkPartToSOG
public bool LinkPartToSOG(SceneObjectGroup grp, SceneObjectPart part, int linkNum)
{
part.SetParentLocalId(grp.RootPart.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 (ISceneEntity 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);
}