mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values
This commit is contained in:
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = (SceneObjectPart)entity;
|
||||
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = (SceneObjectPart)entity;
|
||||
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = (SceneObjectPart)entity;
|
||||
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
// Attachments are high priority,
|
||||
if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
|
||||
if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
|
||||
return 1;
|
||||
|
||||
// Non physical prims are lower priority than physical prims
|
||||
|
||||
@@ -4223,7 +4223,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// their scripts will actually run.
|
||||
// -- Leaf, Tue Aug 12 14:17:05 EDT 2008
|
||||
SceneObjectPart parent = part.ParentGroup.RootPart;
|
||||
if (parent != null && parent.IsAttachment)
|
||||
if (parent != null && part.ParentGroup.IsAttachment)
|
||||
return ScriptDanger(parent, parent.GetWorldPosition());
|
||||
else
|
||||
return ScriptDanger(part, part.GetWorldPosition());
|
||||
@@ -5030,7 +5030,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
delete = true;
|
||||
}
|
||||
|
||||
if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
|
||||
if (delete && !g.IsAttachment && !deletes.Contains(g))
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -146,27 +146,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Is this scene object acting as an attachment?
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We return false if the group has already been deleted.
|
||||
///
|
||||
/// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
|
||||
/// presume either all or no parts in a linkset can be part of an attachment (in which
|
||||
/// case the value would get proprogated down into all the descendent parts).
|
||||
/// </remarks>
|
||||
public bool IsAttachment
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsDeleted)
|
||||
return m_rootPart.IsAttachment;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsAttachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The avatar to which this scene object is attached.
|
||||
@@ -176,6 +160,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </remarks>
|
||||
public UUID AttachedAvatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attachment point of this scene object to an avatar.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 0 if we're not attached to anything
|
||||
/// </remarks>
|
||||
public uint AttachmentPoint;
|
||||
|
||||
/// <summary>
|
||||
/// Is this scene object phantom?
|
||||
/// </summary>
|
||||
@@ -354,11 +346,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Check both the attachment property and the relevant properties of the underlying root part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't
|
||||
/// have the IsAttachment property yet checked.
|
||||
///
|
||||
/// FIXME: However, this should be fixed so that this property
|
||||
/// propertly reflects the underlying status.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
public bool IsAttachmentCheckFull()
|
||||
{
|
||||
@@ -987,11 +981,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_rootPart.Shape.State;
|
||||
}
|
||||
|
||||
public void SetAttachmentPoint(byte point)
|
||||
public void SetAttachmentPoint(uint point)
|
||||
{
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].SetAttachmentPoint(point);
|
||||
AttachmentPoint = point;
|
||||
IsAttachment = point != 0;
|
||||
m_rootPart.Shape.State = (byte)point;
|
||||
}
|
||||
|
||||
public void ClearPartAttachmentData()
|
||||
@@ -1424,16 +1418,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// This is only necessary when userExposed is false!
|
||||
|
||||
bool previousAttachmentStatus = dupe.RootPart.IsAttachment;
|
||||
bool previousAttachmentStatus = dupe.IsAttachment;
|
||||
|
||||
if (!userExposed)
|
||||
dupe.RootPart.IsAttachment = true;
|
||||
dupe.IsAttachment = true;
|
||||
|
||||
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
|
||||
|
||||
if (!userExposed)
|
||||
{
|
||||
dupe.RootPart.IsAttachment = previousAttachmentStatus;
|
||||
dupe.IsAttachment = previousAttachmentStatus;
|
||||
}
|
||||
|
||||
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
||||
|
||||
@@ -213,10 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
get { return m_fromUserInventoryItemID; }
|
||||
}
|
||||
|
||||
|
||||
public bool IsAttachment;
|
||||
|
||||
|
||||
public scriptEvents AggregateScriptEvents;
|
||||
|
||||
@@ -224,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public Vector3 AttachedPos;
|
||||
|
||||
|
||||
public uint AttachmentPoint;
|
||||
|
||||
|
||||
public Vector3 RotationAxis = Vector3.One;
|
||||
|
||||
|
||||
@@ -723,7 +717,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_groupPosition = actor.Position;
|
||||
}
|
||||
|
||||
if (IsAttachment)
|
||||
if (m_parentGroup.IsAttachment)
|
||||
{
|
||||
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
|
||||
if (sp != null)
|
||||
@@ -807,7 +801,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (IsRoot)
|
||||
{
|
||||
if (IsAttachment)
|
||||
if (m_parentGroup.IsAttachment)
|
||||
return AttachedPos;
|
||||
else
|
||||
return AbsolutePosition;
|
||||
@@ -1090,7 +1084,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsAttachment)
|
||||
if (m_parentGroup.IsAttachment)
|
||||
return GroupPosition;
|
||||
|
||||
return m_offsetPosition + m_groupPosition;
|
||||
@@ -1588,7 +1582,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
|
||||
// or flexible
|
||||
if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
|
||||
if (!isPhantom && !m_parentGroup.IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2880,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void rotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
if (IsAttachment)
|
||||
if (m_parentGroup.IsAttachment)
|
||||
{
|
||||
/*
|
||||
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
|
||||
@@ -3014,7 +3008,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (IsRoot)
|
||||
{
|
||||
if (IsAttachment)
|
||||
if (m_parentGroup.IsAttachment)
|
||||
{
|
||||
SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags);
|
||||
}
|
||||
@@ -3076,7 +3070,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// Suppress full updates during attachment editing
|
||||
//
|
||||
if (ParentGroup.IsSelected && IsAttachment)
|
||||
if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
|
||||
return;
|
||||
|
||||
if (ParentGroup.IsDeleted)
|
||||
@@ -3254,26 +3248,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
});
|
||||
}
|
||||
|
||||
public void SetAttachmentPoint(uint AttachmentPoint)
|
||||
{
|
||||
this.AttachmentPoint = AttachmentPoint;
|
||||
|
||||
if (AttachmentPoint != 0)
|
||||
{
|
||||
IsAttachment = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsAttachment = false;
|
||||
}
|
||||
|
||||
// save the attachment point.
|
||||
//if (AttachmentPoint != 0)
|
||||
//{
|
||||
m_shape.State = (byte)AttachmentPoint;
|
||||
//}
|
||||
}
|
||||
|
||||
public void SetAxisRotation(int axis, int rotate)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
@@ -4497,7 +4471,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
if (SetPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
|
||||
if (SetPhantom
|
||||
|| ParentGroup.IsAttachment
|
||||
|| (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
|
||||
{
|
||||
AddFlag(PrimFlags.Phantom);
|
||||
if (PhysActor != null)
|
||||
@@ -4928,7 +4904,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if (IsAttachment && ParentGroup.RootPart != this)
|
||||
if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
|
||||
return;
|
||||
|
||||
// Causes this thread to dig into the Client Thread Data.
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Don't let this set the HasGroupChanged flag for attachments
|
||||
// as this happens during rez and we don't want a new asset
|
||||
// for each attachment each time
|
||||
if (!m_part.ParentGroup.RootPart.IsAttachment)
|
||||
if (!m_part.ParentGroup.IsAttachment)
|
||||
{
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
|
||||
@@ -3178,7 +3178,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ISceneObject clone = sog.CloneForNewScene();
|
||||
// Attachment module assumes that GroupPosition holds the offsets...!
|
||||
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
|
||||
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
|
||||
((SceneObjectGroup)clone).IsAttachment = false;
|
||||
cAgent.AttachmentObjects.Add(clone);
|
||||
string state = sog.GetStateSnapshot();
|
||||
cAgent.AttachmentObjectStates.Add(state);
|
||||
@@ -3477,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
foreach (SceneObjectGroup so in m_attachments)
|
||||
{
|
||||
if (attachmentPoint == so.RootPart.AttachmentPoint)
|
||||
if (attachmentPoint == so.AttachmentPoint)
|
||||
attachments.Add(so);
|
||||
}
|
||||
}
|
||||
@@ -3869,12 +3869,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (grp.HasGroupChanged) // Resizer scripts?
|
||||
{
|
||||
grp.RootPart.IsAttachment = false;
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
// grp.DetachToInventoryPrep();
|
||||
attachmentsModule.UpdateKnownItem(ControllingClient,
|
||||
grp, grp.GetFromItemID(), grp.OwnerID);
|
||||
grp.RootPart.IsAttachment = true;
|
||||
grp.IsAttachment = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +120,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// We deal with the possibility that two updates occur at
|
||||
// the same unix time at the update point itself.
|
||||
|
||||
if ((update.LastFullUpdateTime < part.TimeStampFull) ||
|
||||
part.IsAttachment)
|
||||
if ((update.LastFullUpdateTime < part.TimeStampFull) || part.ParentGroup.IsAttachment)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",
|
||||
|
||||
Reference in New Issue
Block a user