diff options
author | Melanie | 2012-04-25 19:09:22 +0100 |
---|---|---|
committer | Melanie | 2012-04-25 19:09:22 +0100 |
commit | 88553bb884c5c8849ec61362e65fe0950c1e3080 (patch) | |
tree | cea887a9eec906ada9c7eaa273c354761bcc1bbe /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.zip opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.gz opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.bz2 opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.xz |
Port Avination link order to make OpenSim behave like SL. Make Primstar scripts work. Fixes Mantis #5990
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 49a3485..2686004 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1969,6 +1969,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> | 1969 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
1970 | public void LinkToGroup(SceneObjectGroup objectGroup) | 1970 | public void LinkToGroup(SceneObjectGroup objectGroup) |
1971 | { | 1971 | { |
1972 | LinkToGroup(objectGroup, false); | ||
1973 | } | ||
1974 | |||
1975 | public void LinkToGroup(SceneObjectGroup objectGroup, bool insert) | ||
1976 | { | ||
1972 | // m_log.DebugFormat( | 1977 | // m_log.DebugFormat( |
1973 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", | 1978 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", |
1974 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); | 1979 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); |
@@ -1979,6 +1984,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1979 | 1984 | ||
1980 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 1985 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
1981 | 1986 | ||
1987 | // physics flags from group to be applied to linked parts | ||
1988 | bool grpusephys = UsesPhysics; | ||
1989 | bool grptemporary = IsTemporary; | ||
1990 | |||
1982 | Vector3 oldGroupPosition = linkPart.GroupPosition; | 1991 | Vector3 oldGroupPosition = linkPart.GroupPosition; |
1983 | Quaternion oldRootRotation = linkPart.RotationOffset; | 1992 | Quaternion oldRootRotation = linkPart.RotationOffset; |
1984 | 1993 | ||
@@ -2002,15 +2011,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2002 | 2011 | ||
2003 | lock (m_parts.SyncRoot) | 2012 | lock (m_parts.SyncRoot) |
2004 | { | 2013 | { |
2005 | int linkNum = PrimCount + 1; | 2014 | int linkNum; |
2015 | if (insert) | ||
2016 | { | ||
2017 | linkNum = 2; | ||
2018 | foreach (SceneObjectPart part in Parts) | ||
2019 | { | ||
2020 | if (part.LinkNum > 1) | ||
2021 | part.LinkNum++; | ||
2022 | } | ||
2023 | } | ||
2024 | else | ||
2025 | { | ||
2026 | linkNum = PrimCount + 1; | ||
2027 | } | ||
2006 | 2028 | ||
2007 | m_parts.Add(linkPart.UUID, linkPart); | 2029 | m_parts.Add(linkPart.UUID, linkPart); |
2008 | 2030 | ||
2009 | linkPart.SetParent(this); | 2031 | linkPart.SetParent(this); |
2010 | linkPart.CreateSelected = true; | 2032 | linkPart.CreateSelected = true; |
2011 | 2033 | ||
2034 | // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now | ||
2035 | linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive); | ||
2036 | if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2037 | { | ||
2038 | linkPart.PhysActor.link(m_rootPart.PhysActor); | ||
2039 | this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor); | ||
2040 | } | ||
2041 | |||
2012 | linkPart.LinkNum = linkNum++; | 2042 | linkPart.LinkNum = linkNum++; |
2013 | linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect); | ||
2014 | 2043 | ||
2015 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2044 | SceneObjectPart[] ogParts = objectGroup.Parts; |
2016 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) | 2045 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) |
@@ -2022,7 +2051,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2022 | { | 2051 | { |
2023 | SceneObjectPart part = ogParts[i]; | 2052 | SceneObjectPart part = ogParts[i]; |
2024 | if (part.UUID != objectGroup.m_rootPart.UUID) | 2053 | if (part.UUID != objectGroup.m_rootPart.UUID) |
2054 | { | ||
2025 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); | 2055 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); |
2056 | // let physics know | ||
2057 | part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive); | ||
2058 | if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2059 | { | ||
2060 | part.PhysActor.link(m_rootPart.PhysActor); | ||
2061 | this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | ||
2062 | } | ||
2063 | } | ||
2026 | part.ClearUndoState(); | 2064 | part.ClearUndoState(); |
2027 | } | 2065 | } |
2028 | } | 2066 | } |