aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2008-10-28 11:26:23 +0000
committerDr Scofield2008-10-28 11:26:23 +0000
commit1a06045c981bae6fa982d0dcafcf311f78ce47fc (patch)
tree20ed1f2bda92886919046b0a77c504ea8d0c4e6c
parentMantis #2486 (diff)
downloadopensim-SC-1a06045c981bae6fa982d0dcafcf311f78ce47fc.zip
opensim-SC-1a06045c981bae6fa982d0dcafcf311f78ce47fc.tar.gz
opensim-SC-1a06045c981bae6fa982d0dcafcf311f78ce47fc.tar.bz2
opensim-SC-1a06045c981bae6fa982d0dcafcf311f78ce47fc.tar.xz
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.
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs67
2 files changed, 41 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 34224a7..295569e 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1373,7 +1373,8 @@ namespace OpenSim.Region.Environment.Scenes
1373 List<SceneObjectGroup> children = new List<SceneObjectGroup>(); 1373 List<SceneObjectGroup> children = new List<SceneObjectGroup>();
1374 if (parenPrim != null) 1374 if (parenPrim != null)
1375 { 1375 {
1376 for (int i = 0; i < childPrims.Count; i++) 1376 // We do this in reverse to get the link order of the prims correct
1377 for (int i = childPrims.Count - 1; i >= 0; i--)
1377 { 1378 {
1378 foreach (EntityBase ent in EntityList) 1379 foreach (EntityBase ent in EntityList)
1379 { 1380 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 02098b7..32c9255 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1830,29 +1830,42 @@ namespace OpenSim.Region.Environment.Scenes
1830 lock (m_parts) 1830 lock (m_parts)
1831 { 1831 {
1832 m_parts.Add(linkPart.UUID, linkPart); 1832 m_parts.Add(linkPart.UUID, linkPart);
1833 }
1834
1835 linkPart.LinkNum = m_parts.Count;
1836
1837 linkPart.SetParent(this);
1838 linkPart.AddFlag(PrimFlags.CreateSelected);
1839
1840 //if (linkPart.PhysActor != null)
1841 //{
1842 // m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
1843 1833
1844 //linkPart.PhysActor = null; 1834 // Insert in terms of link numbers, the new links
1845 //} 1835 // before the current ones (with the exception of
1846 1836 // the root prim. Shuffle the old ones up
1847 //TODO: rest of parts 1837 foreach (KeyValuePair<UUID, SceneObjectPart> kvp in m_parts)
1848 foreach (SceneObjectPart part in objectGroup.Children.Values) 1838 {
1849 { 1839 if (kvp.Value.LinkNum != 1) {
1850 if (part.UUID != objectGroup.m_rootPart.UUID) 1840 // Don't update root prim link number
1851 { 1841 kvp.Value.LinkNum += objectGroup.PrimCount;
1852 LinkNonRootPart(part, oldGroupPosition, oldRootRotation); 1842 }
1853 } 1843 }
1854 part.ClearUndoState(); 1844
1855 } 1845
1846 linkPart.LinkNum = 2;
1847
1848 linkPart.SetParent(this);
1849 linkPart.AddFlag(PrimFlags.CreateSelected);
1850
1851 //if (linkPart.PhysActor != null)
1852 //{
1853 // m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
1854
1855 //linkPart.PhysActor = null;
1856 //}
1857
1858 //TODO: rest of parts
1859 int linkNum = 3;
1860 foreach (SceneObjectPart part in objectGroup.Children.Values)
1861 {
1862 if (part.UUID != objectGroup.m_rootPart.UUID)
1863 {
1864 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
1865 }
1866 part.ClearUndoState();
1867 }
1868 }
1856 1869
1857 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 1870 m_scene.UnlinkSceneObject(objectGroup.UUID, true);
1858 objectGroup.Children.Clear(); 1871 objectGroup.Children.Clear();
@@ -1961,17 +1974,15 @@ namespace OpenSim.Region.Environment.Scenes
1961 m_isBackedUp = false; 1974 m_isBackedUp = false;
1962 } 1975 }
1963 1976
1964 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) 1977 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
1965 { 1978 {
1966 part.SetParent(this); 1979 part.SetParent(this);
1967 part.ParentID = m_rootPart.LocalId; 1980 part.ParentID = m_rootPart.LocalId;
1968 1981
1969 lock (m_parts) 1982 // Caller locks m_parts for us
1970 { 1983 m_parts.Add(part.UUID, part);
1971 m_parts.Add(part.UUID, part);
1972 }
1973 1984
1974 part.LinkNum = m_parts.Count; 1985 part.LinkNum = linkNum;
1975 1986
1976 Vector3 oldPos = part.OffsetPosition; 1987 Vector3 oldPos = part.OffsetPosition;
1977 oldPos *= oldGroupRotation; 1988 oldPos *= oldGroupRotation;