From: Christopher Yeoh <yeohc@au1.ibm.com>
The attached patch fixes the bug where when linking in a new set of prims to an already linked set of objects the prims were placed at the end of the list rather than just after the root prim. ie. link prim order result was different on OpenSim compared to an LL server. This causes a few issues with respect to compatibility of scripts, especially when using llCreateLink.0.6.0-stable
parent
8ea4553d39
commit
1a06045c98
|
@ -1373,7 +1373,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
List<SceneObjectGroup> children = new List<SceneObjectGroup>();
|
||||
if (parenPrim != null)
|
||||
{
|
||||
for (int i = 0; i < childPrims.Count; i++)
|
||||
// We do this in reverse to get the link order of the prims correct
|
||||
for (int i = childPrims.Count - 1; i >= 0; i--)
|
||||
{
|
||||
foreach (EntityBase ent in EntityList)
|
||||
{
|
||||
|
|
|
@ -1830,9 +1830,20 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
lock (m_parts)
|
||||
{
|
||||
m_parts.Add(linkPart.UUID, linkPart);
|
||||
|
||||
// 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 (KeyValuePair<UUID, SceneObjectPart> kvp in m_parts)
|
||||
{
|
||||
if (kvp.Value.LinkNum != 1) {
|
||||
// Don't update root prim link number
|
||||
kvp.Value.LinkNum += objectGroup.PrimCount;
|
||||
}
|
||||
}
|
||||
|
||||
linkPart.LinkNum = m_parts.Count;
|
||||
|
||||
linkPart.LinkNum = 2;
|
||||
|
||||
linkPart.SetParent(this);
|
||||
linkPart.AddFlag(PrimFlags.CreateSelected);
|
||||
|
@ -1845,14 +1856,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//}
|
||||
|
||||
//TODO: rest of parts
|
||||
int linkNum = 3;
|
||||
foreach (SceneObjectPart part in objectGroup.Children.Values)
|
||||
{
|
||||
if (part.UUID != objectGroup.m_rootPart.UUID)
|
||||
{
|
||||
LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
|
||||
LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
|
||||
}
|
||||
part.ClearUndoState();
|
||||
}
|
||||
}
|
||||
|
||||
m_scene.UnlinkSceneObject(objectGroup.UUID, true);
|
||||
objectGroup.Children.Clear();
|
||||
|
@ -1961,17 +1974,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_isBackedUp = false;
|
||||
}
|
||||
|
||||
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
|
||||
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
|
||||
{
|
||||
part.SetParent(this);
|
||||
part.ParentID = m_rootPart.LocalId;
|
||||
|
||||
lock (m_parts)
|
||||
{
|
||||
// Caller locks m_parts for us
|
||||
m_parts.Add(part.UUID, part);
|
||||
}
|
||||
|
||||
part.LinkNum = m_parts.Count;
|
||||
part.LinkNum = linkNum;
|
||||
|
||||
Vector3 oldPos = part.OffsetPosition;
|
||||
oldPos *= oldGroupRotation;
|
||||
|
|
Loading…
Reference in New Issue