aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs119
1 files changed, 51 insertions, 68 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 77c66b6..238ec8e 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1865,7 +1865,8 @@ namespace OpenSim.Region.Framework.Scenes
1865 1865
1866 // this is here so physics gets updated! 1866 // this is here so physics gets updated!
1867 // Don't remove! Bad juju! Stay away! or fix physics! 1867 // Don't remove! Bad juju! Stay away! or fix physics!
1868 child.AbsolutePosition = child.AbsolutePosition; 1868 // already done in LinkToGroup
1869// child.AbsolutePosition = child.AbsolutePosition;
1869 } 1870 }
1870 } 1871 }
1871 1872
@@ -1912,31 +1913,36 @@ namespace OpenSim.Region.Framework.Scenes
1912 // 1913 //
1913 foreach (SceneObjectPart part in prims) 1914 foreach (SceneObjectPart part in prims)
1914 { 1915 {
1915 if (part != null) 1916 if(part == null)
1917 continue;
1918 SceneObjectGroup parentSOG = part.ParentGroup;
1919 if(parentSOG == null ||
1920 parentSOG.IsDeleted ||
1921 parentSOG.inTransit ||
1922 parentSOG.PrimCount == 1)
1923 continue;
1924
1925 if (!affectedGroups.Contains(parentSOG))
1916 { 1926 {
1917 if (part.KeyframeMotion != null) 1927 affectedGroups.Add(parentSOG);
1918 { 1928 if(parentSOG.RootPart.PhysActor != null)
1919 part.KeyframeMotion.Stop(); 1929 parentSOG.RootPart.PhysActor.Building = true;
1920 part.KeyframeMotion = null; 1930 }
1921 }
1922 if (part.ParentGroup.PrimCount != 1) // Skip single
1923 {
1924 if (part.LinkNum < 2) // Root
1925 {
1926 rootParts.Add(part);
1927 }
1928 else
1929 {
1930 part.LastOwnerID = part.ParentGroup.RootPart.LastOwnerID;
1931 childParts.Add(part);
1932 }
1933 1931
1934 SceneObjectGroup group = part.ParentGroup; 1932 if (part.KeyframeMotion != null)
1935 if (!affectedGroups.Contains(group)) 1933 {
1936 { 1934 part.KeyframeMotion.Stop();
1937 affectedGroups.Add(group); 1935 part.KeyframeMotion = null;
1938 } 1936 }
1939 } 1937
1938 if (part.LinkNum < 2) // Root
1939 {
1940 rootParts.Add(part);
1941 }
1942 else
1943 {
1944 part.LastOwnerID = part.ParentGroup.RootPart.LastOwnerID;
1945 childParts.Add(part);
1940 } 1946 }
1941 } 1947 }
1942 1948
@@ -1945,8 +1951,8 @@ namespace OpenSim.Region.Framework.Scenes
1945 foreach (SceneObjectPart child in childParts) 1951 foreach (SceneObjectPart child in childParts)
1946 { 1952 {
1947 // Unlink all child parts from their groups 1953 // Unlink all child parts from their groups
1948 //
1949 child.ParentGroup.DelinkFromGroup(child, true); 1954 child.ParentGroup.DelinkFromGroup(child, true);
1955 //child.ParentGroup is now other
1950 child.ParentGroup.HasGroupChanged = true; 1956 child.ParentGroup.HasGroupChanged = true;
1951 child.ParentGroup.ScheduleGroupForFullUpdate(); 1957 child.ParentGroup.ScheduleGroupForFullUpdate();
1952 } 1958 }
@@ -1959,74 +1965,51 @@ namespace OpenSim.Region.Framework.Scenes
1959 // However, editing linked parts and unlinking may be different 1965 // However, editing linked parts and unlinking may be different
1960 // 1966 //
1961 SceneObjectGroup group = root.ParentGroup; 1967 SceneObjectGroup group = root.ParentGroup;
1962 1968
1963 List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Parts); 1969 List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Parts);
1964 int numChildren = newSet.Count;
1965 1970
1966 if (numChildren == 1) 1971 newSet.Remove(root);
1972 int numChildren = newSet.Count;
1973 if(numChildren == 0)
1967 break; 1974 break;
1968 1975
1969 // If there are prims left in a link set, but the root is
1970 // slated for unlink, we need to do this
1971 // Unlink the remaining set
1972 //
1973 bool sendEventsToRemainder = false;
1974 if (numChildren == 2) // only one child prim no re-link needed
1975 sendEventsToRemainder = true;
1976
1977 foreach (SceneObjectPart p in newSet) 1976 foreach (SceneObjectPart p in newSet)
1978 { 1977 group.DelinkFromGroup(p, false);
1979 if (p != group.RootPart)
1980 {
1981 group.DelinkFromGroup(p, sendEventsToRemainder);
1982 if (sendEventsToRemainder) // finish single child prim now
1983 {
1984 p.ParentGroup.HasGroupChanged = true;
1985 p.ParentGroup.ScheduleGroupForFullUpdate();
1986 }
1987 }
1988 }
1989 1978
1979 SceneObjectPart newRoot = newSet[0];
1980
1990 // If there is more than one prim remaining, we 1981 // If there is more than one prim remaining, we
1991 // need to re-link 1982 // need to re-link
1992 // 1983 //
1993 if (numChildren > 2) 1984 if (numChildren > 1)
1994 { 1985 {
1995 // Remove old root
1996 //
1997 if (newSet.Contains(root))
1998 newSet.Remove(root);
1999
2000 // Preserve link ordering
2001 //
2002 newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b)
2003 {
2004 return a.LinkNum.CompareTo(b.LinkNum);
2005 });
2006
2007 // Determine new root 1986 // Determine new root
2008 // 1987 //
2009 SceneObjectPart newRoot = newSet[0];
2010 newSet.RemoveAt(0); 1988 newSet.RemoveAt(0);
2011 1989 foreach (SceneObjectPart newChild in newSet)
2012 foreach (SceneObjectPart newChild in newSet) 1990 newChild.ClearUpdateSchedule();
2013 newChild.ClearUpdateSchedule();
2014 1991
2015 LinkObjects(newRoot, newSet); 1992 LinkObjects(newRoot, newSet);
2016// if (!affectedGroups.Contains(newRoot.ParentGroup)) 1993 }
2017// affectedGroups.Add(newRoot.ParentGroup); 1994 else
1995 {
1996 newRoot.TriggerScriptChangedEvent(Changed.LINK);
1997 newRoot.ParentGroup.HasGroupChanged = true;
1998 newRoot.ParentGroup.ScheduleGroupForFullUpdate();
2018 } 1999 }
2019 } 2000 }
2020 2001
2021 // Finally, trigger events in the roots 2002 // trigger events in the roots
2022 // 2003 //
2023 foreach (SceneObjectGroup g in affectedGroups) 2004 foreach (SceneObjectGroup g in affectedGroups)
2024 { 2005 {
2006 if(g.RootPart.PhysActor != null)
2007 g.RootPart.PhysActor.Building = false;
2008 g.AdjustChildPrimPermissions(false);
2025 // Child prims that have been unlinked and deleted will 2009 // Child prims that have been unlinked and deleted will
2026 // return unless the root is deleted. This will remove them 2010 // return unless the root is deleted. This will remove them
2027 // from the database. They will be rewritten immediately, 2011 // from the database. They will be rewritten immediately,
2028 // minus the rows for the unlinked child prims. 2012 // minus the rows for the unlinked child prims.
2029 g.AdjustChildPrimPermissions(false);
2030 m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); 2013 m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
2031 g.TriggerScriptChangedEvent(Changed.LINK); 2014 g.TriggerScriptChangedEvent(Changed.LINK);
2032 g.HasGroupChanged = true; // Persist 2015 g.HasGroupChanged = true; // Persist