diff options
author | Justin Clarke Casey | 2008-09-12 00:37:59 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-12 00:37:59 +0000 |
commit | 3f1dbae8e4f47056555f9ecfaa32e959293ada48 (patch) | |
tree | 95927494337456a028446333efcabb4cf79d66db /OpenSim/Region/Environment/Scenes | |
parent | Revert 6242 because of a possible licensing issue (diff) | |
download | opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.zip opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.gz opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.bz2 opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.xz |
* minor: various doc and tidy up, logging increase to make it clearer which prim is failing a border crossing
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 83 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 16 |
3 files changed, 80 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d8ce3f0..9c2dd06 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1871,13 +1871,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | /// <summary> | 1873 | /// <summary> |
1874 | /// Locate New region Handle and offset the prim position for the new region | 1874 | /// Move the given scene object into a new region depending on which region its absolute position has moved |
1875 | /// | 1875 | /// into. |
1876 | /// | ||
1877 | /// This method locates the new region handle and offsets the prim position for the new region | ||
1876 | /// </summary> | 1878 | /// </summary> |
1877 | /// <param name="position">current position of Group</param> | 1879 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> |
1878 | /// <param name="grp">Scene Object Group that we're crossing</param> | 1880 | /// <param name="grp">the scene object that we're crossing</param> |
1879 | 1881 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp) | |
1880 | public void CrossPrimGroupIntoNewRegion(Vector3 position, SceneObjectGroup grp) | ||
1881 | { | 1882 | { |
1882 | if (grp == null) | 1883 | if (grp == null) |
1883 | return; | 1884 | return; |
@@ -1897,53 +1898,70 @@ namespace OpenSim.Region.Environment.Scenes | |||
1897 | } | 1898 | } |
1898 | return; | 1899 | return; |
1899 | } | 1900 | } |
1900 | 1901 | ||
1901 | m_log.Warn("Prim crossing: " + grp.ToString()); | ||
1902 | int thisx = (int)RegionInfo.RegionLocX; | 1902 | int thisx = (int)RegionInfo.RegionLocX; |
1903 | int thisy = (int)RegionInfo.RegionLocY; | 1903 | int thisy = (int)RegionInfo.RegionLocY; |
1904 | 1904 | ||
1905 | ulong newRegionHandle = 0; | 1905 | ulong newRegionHandle = 0; |
1906 | Vector3 pos = position; | 1906 | Vector3 pos = attemptedPosition; |
1907 | 1907 | ||
1908 | if (position.X > Constants.RegionSize + 0.1f) | 1908 | if (attemptedPosition.X > Constants.RegionSize + 0.1f) |
1909 | { | 1909 | { |
1910 | pos.X = ((pos.X - Constants.RegionSize)); | 1910 | pos.X = ((pos.X - Constants.RegionSize)); |
1911 | newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | 1911 | newRegionHandle |
1912 | = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | ||
1912 | // x + 1 | 1913 | // x + 1 |
1913 | } | 1914 | } |
1914 | else if (position.X < -0.1f) | 1915 | else if (attemptedPosition.X < -0.1f) |
1915 | { | 1916 | { |
1916 | pos.X = ((pos.X + Constants.RegionSize)); | 1917 | pos.X = ((pos.X + Constants.RegionSize)); |
1917 | newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | 1918 | newRegionHandle |
1919 | = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | ||
1918 | // x - 1 | 1920 | // x - 1 |
1919 | } | 1921 | } |
1920 | 1922 | ||
1921 | if (position.Y > Constants.RegionSize + 0.1f) | 1923 | if (attemptedPosition.Y > Constants.RegionSize + 0.1f) |
1922 | { | 1924 | { |
1923 | pos.Y = ((pos.Y - Constants.RegionSize)); | 1925 | pos.Y = ((pos.Y - Constants.RegionSize)); |
1924 | newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); | 1926 | newRegionHandle |
1927 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); | ||
1925 | // y + 1 | 1928 | // y + 1 |
1926 | } | 1929 | } |
1927 | else if (position.Y < -1f) | 1930 | else if (attemptedPosition.Y < -1f) |
1928 | { | 1931 | { |
1929 | pos.Y = ((pos.Y + Constants.RegionSize)); | 1932 | pos.Y = ((pos.Y + Constants.RegionSize)); |
1930 | newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); | 1933 | newRegionHandle |
1934 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); | ||
1931 | // y - 1 | 1935 | // y - 1 |
1932 | } | 1936 | } |
1933 | 1937 | ||
1934 | // Offset the positions for the new region across the border | 1938 | // Offset the positions for the new region across the border |
1939 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | ||
1935 | grp.OffsetForNewRegion(pos); | 1940 | grp.OffsetForNewRegion(pos); |
1936 | 1941 | ||
1937 | CrossPrimGroupIntoNewRegion(newRegionHandle, grp); | 1942 | // If we fail to cross the border, then reset the position of the scene object on that border. |
1943 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp)) | ||
1944 | { | ||
1945 | grp.OffsetForNewRegion(oldGroupPosition); | ||
1946 | } | ||
1938 | } | 1947 | } |
1939 | 1948 | ||
1940 | public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) | 1949 | /// <summary> |
1950 | /// Move the given scene object into a new region | ||
1951 | /// </summary> | ||
1952 | /// <param name="newRegionHandle"></param> | ||
1953 | /// <param name="grp">Scene Object Group that we're crossing</param> | ||
1954 | /// <returns> | ||
1955 | /// true if the crossing itself was successful, false on failure | ||
1956 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region | ||
1957 | /// </returns> | ||
1958 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) | ||
1941 | { | 1959 | { |
1960 | bool successYN = false; | ||
1942 | int primcrossingXMLmethod = 0; | 1961 | int primcrossingXMLmethod = 0; |
1962 | |||
1943 | if (newRegionHandle != 0) | 1963 | if (newRegionHandle != 0) |
1944 | { | 1964 | { |
1945 | bool successYN = false; | ||
1946 | |||
1947 | successYN | 1965 | successYN |
1948 | = m_sceneGridService.PrimCrossToNeighboringRegion( | 1966 | = m_sceneGridService.PrimCrossToNeighboringRegion( |
1949 | newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | 1967 | newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); |
@@ -1955,14 +1973,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1955 | { | 1973 | { |
1956 | DeleteSceneObject(grp); | 1974 | DeleteSceneObject(grp); |
1957 | } | 1975 | } |
1958 | catch (Exception) | 1976 | catch (Exception e) |
1959 | { | 1977 | { |
1960 | m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); | 1978 | m_log.ErrorFormat( |
1979 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", | ||
1980 | grp, e); | ||
1961 | } | 1981 | } |
1962 | } | 1982 | } |
1963 | else | 1983 | else |
1964 | { | 1984 | { |
1965 | m_log.Warn("[INTERREGION]: Prim Crossing Failed!"); | ||
1966 | if (grp.RootPart != null) | 1985 | if (grp.RootPart != null) |
1967 | { | 1986 | { |
1968 | if (grp.RootPart.PhysActor != null) | 1987 | if (grp.RootPart.PhysActor != null) |
@@ -1970,10 +1989,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
1970 | grp.RootPart.PhysActor.CrossingFailure(); | 1989 | grp.RootPart.PhysActor.CrossingFailure(); |
1971 | } | 1990 | } |
1972 | } | 1991 | } |
1992 | |||
1993 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); | ||
1973 | } | 1994 | } |
1974 | } | 1995 | } |
1996 | else | ||
1997 | { | ||
1998 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); | ||
1999 | } | ||
2000 | |||
2001 | return successYN; | ||
1975 | } | 2002 | } |
1976 | 2003 | ||
2004 | /// <summary> | ||
2005 | /// Handle a scene object that is crossing into this region from another. | ||
2006 | /// </summary> | ||
2007 | /// <param name="regionHandle"></param> | ||
2008 | /// <param name="primID"></param> | ||
2009 | /// <param name="objXMLData"></param> | ||
2010 | /// <param name="XMLMethod"></param> | ||
2011 | /// <returns></returns> | ||
1977 | public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod) | 2012 | public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod) |
1978 | { | 2013 | { |
1979 | m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); | 2014 | m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 1b2ea8e..f52e764 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -180,6 +180,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | /// <summary> | ||
184 | /// The absolute position of this scene object in the scene | ||
185 | /// </summary> | ||
183 | public override Vector3 AbsolutePosition | 186 | public override Vector3 AbsolutePosition |
184 | { | 187 | { |
185 | get | 188 | get |
@@ -195,8 +198,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
195 | set | 198 | set |
196 | { | 199 | { |
197 | Vector3 val = value; | 200 | Vector3 val = value; |
201 | |||
198 | if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.IsAttachment) | 202 | if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.IsAttachment) |
199 | { | 203 | { |
200 | m_scene.CrossPrimGroupIntoNewRegion(val, this); | 204 | m_scene.CrossPrimGroupIntoNewRegion(val, this); |
201 | } | 205 | } |
202 | 206 | ||
@@ -899,7 +903,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
899 | public void ResetChildPrimPhysicsPositions() | 903 | public void ResetChildPrimPhysicsPositions() |
900 | { | 904 | { |
901 | AbsolutePosition = AbsolutePosition; // could someone in the know please explain how this works? | 905 | AbsolutePosition = AbsolutePosition; // could someone in the know please explain how this works? |
902 | //HasGroupChanged = false; | ||
903 | } | 906 | } |
904 | 907 | ||
905 | public UUID GetPartsFullID(uint localID) | 908 | public UUID GetPartsFullID(uint localID) |
@@ -1090,10 +1093,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1090 | { | 1093 | { |
1091 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); | 1094 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); |
1092 | } | 1095 | } |
1093 | 1096 | ||
1094 | // Hack to get the physics scene geometries in the right spot | 1097 | // Hack to get the physics scene geometries in the right spot |
1095 | ResetChildPrimPhysicsPositions(); | 1098 | ResetChildPrimPhysicsPositions(); |
1096 | } | 1099 | } |
1097 | } | 1100 | } |
1098 | else | 1101 | else |
1099 | { | 1102 | { |
@@ -2706,5 +2709,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2706 | part.TriggerScriptChangedEvent(val); | 2709 | part.TriggerScriptChangedEvent(val); |
2707 | } | 2710 | } |
2708 | } | 2711 | } |
2712 | |||
2713 | public override string ToString() | ||
2714 | { | ||
2715 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | ||
2716 | } | ||
2709 | } | 2717 | } |
2710 | } | 2718 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index eaabdd5..2b0ad12 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -108,8 +108,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
108 | [XmlIgnore] | 108 | [XmlIgnore] |
109 | public PhysicsActor PhysActor = null; | 109 | public PhysicsActor PhysActor = null; |
110 | 110 | ||
111 | |||
112 | |||
113 | //Xantor 20080528 Sound stuff: | 111 | //Xantor 20080528 Sound stuff: |
114 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 112 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
115 | // Not a big problem as long as the script that sets it remains in the prim on startup. | 113 | // Not a big problem as long as the script that sets it remains in the prim on startup. |
@@ -443,6 +441,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
443 | set { m_particleSystem = value; } | 441 | set { m_particleSystem = value; } |
444 | } | 442 | } |
445 | 443 | ||
444 | /// <summary> | ||
445 | /// The position of the entire group that this prim belongs to. | ||
446 | /// </summary> | ||
446 | public Vector3 GroupPosition | 447 | public Vector3 GroupPosition |
447 | { | 448 | { |
448 | get | 449 | get |
@@ -475,18 +476,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
475 | { | 476 | { |
476 | try | 477 | try |
477 | { | 478 | { |
478 | |||
479 | // Root prim actually goes at Position | 479 | // Root prim actually goes at Position |
480 | if (_parentID == 0) | 480 | if (_parentID == 0) |
481 | { | 481 | { |
482 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | 482 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); |
483 | |||
484 | } | 483 | } |
485 | else | 484 | else |
486 | { | 485 | { |
487 | |||
488 | // To move the child prim in respect to the group position and rotation we have to calculate | 486 | // To move the child prim in respect to the group position and rotation we have to calculate |
489 | |||
490 | Vector3 resultingposition = GetWorldPosition(); | 487 | Vector3 resultingposition = GetWorldPosition(); |
491 | PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); | 488 | PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); |
492 | Quaternion resultingrot = GetWorldRotation(); | 489 | Quaternion resultingrot = GetWorldRotation(); |
@@ -783,8 +780,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
783 | get { return m_parentGroup; } | 780 | get { return m_parentGroup; } |
784 | } | 781 | } |
785 | 782 | ||
786 | |||
787 | |||
788 | public scriptEvents ScriptEvents | 783 | public scriptEvents ScriptEvents |
789 | { | 784 | { |
790 | get { return AggregateScriptEvents; } | 785 | get { return AggregateScriptEvents; } |
@@ -3321,6 +3316,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
3321 | public bool GetForceMouselook() { | 3316 | public bool GetForceMouselook() { |
3322 | return m_forceMouselook; | 3317 | return m_forceMouselook; |
3323 | } | 3318 | } |
3319 | |||
3320 | public override string ToString() | ||
3321 | { | ||
3322 | return String.Format("{0} {1} (parent {2}))", Name, UUID, ParentGroup); | ||
3323 | } | ||
3324 | 3324 | ||
3325 | #endregion Public Methods | 3325 | #endregion Public Methods |
3326 | } | 3326 | } |