aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authormeta72010-08-07 16:52:03 -0700
committermeta72010-08-07 16:52:03 -0700
commit19ab4c950880beb3ac88a172b775c3973782ec3d (patch)
treea52a808db7722d06e5117c63e1045d3cae5b82d0 /OpenSim
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC_OLD-19ab4c950880beb3ac88a172b775c3973782ec3d.zip
opensim-SC_OLD-19ab4c950880beb3ac88a172b775c3973782ec3d.tar.gz
opensim-SC_OLD-19ab4c950880beb3ac88a172b775c3973782ec3d.tar.bz2
opensim-SC_OLD-19ab4c950880beb3ac88a172b775c3973782ec3d.tar.xz
Fix a rather nasty issue where the Backup() process causes objects and avatars sitting on them to be pushed to the corner of the sim.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs199
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs25
2 files changed, 120 insertions, 104 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a828127..0d15cb4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -317,8 +317,8 @@ namespace OpenSim.Region.Framework.Scenes
317 private bool m_scriptListens_notAtTarget = false; 317 private bool m_scriptListens_notAtTarget = false;
318 318
319 private bool m_scriptListens_atRotTarget = false; 319 private bool m_scriptListens_atRotTarget = false;
320 private bool m_scriptListens_notAtRotTarget = false; 320 private bool m_scriptListens_notAtRotTarget = false;
321 321 public bool m_dupeInProgress = false;
322 internal Dictionary<UUID, string> m_savedScriptState = null; 322 internal Dictionary<UUID, string> m_savedScriptState = null;
323 323
324 #region Properties 324 #region Properties
@@ -475,16 +475,21 @@ namespace OpenSim.Region.Framework.Scenes
475 { 475 {
476 part.IgnoreUndoUpdate = false; 476 part.IgnoreUndoUpdate = false;
477 part.StoreUndoState(UndoType.STATE_GROUP_POSITION); 477 part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
478 part.GroupPosition = val; 478 part.GroupPosition = val;
479 part.TriggerScriptChangedEvent(Changed.POSITION); 479 if (!m_dupeInProgress)
480 } 480 {
481 481 part.TriggerScriptChangedEvent(Changed.POSITION);
482 foreach (ScenePresence av in m_linkedAvatars) 482 }
483 { 483 }
484 Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; 484 if (!m_dupeInProgress)
485 av.AbsolutePosition += offset; 485 {
486 av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition 486 foreach (ScenePresence av in m_linkedAvatars)
487 av.SendFullUpdateToAllClients(); 487 {
488 Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition;
489 av.AbsolutePosition += offset;
490 av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
491 av.SendFullUpdateToAllClients();
492 }
488 } 493 }
489 494
490 //if (m_rootPart.PhysActor != null) 495 //if (m_rootPart.PhysActor != null)
@@ -1800,88 +1805,96 @@ namespace OpenSim.Region.Framework.Scenes
1800 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> 1805 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
1801 /// <returns></returns> 1806 /// <returns></returns>
1802 public SceneObjectGroup Copy(bool userExposed) 1807 public SceneObjectGroup Copy(bool userExposed)
1803 { 1808 {
1804 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1809 SceneObjectGroup dupe;
1805 dupe.m_isBackedUp = false; 1810 try
1806 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); 1811 {
1807 1812 m_dupeInProgress = true;
1808 // Warning, The following code related to previousAttachmentStatus is needed so that clones of 1813 dupe = (SceneObjectGroup)MemberwiseClone();
1809 // attachments do not bordercross while they're being duplicated. This is hacktastic! 1814 dupe.m_isBackedUp = false;
1810 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! 1815 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
1811 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state 1816
1812 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, 1817 // Warning, The following code related to previousAttachmentStatus is needed so that clones of
1813 // then restore it's attachment state 1818 // attachments do not bordercross while they're being duplicated. This is hacktastic!
1814 1819 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
1815 // This is only necessary when userExposed is false! 1820 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
1816 1821 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
1817 bool previousAttachmentStatus = dupe.RootPart.IsAttachment; 1822 // then restore it's attachment state
1818 1823
1819 if (!userExposed) 1824 // This is only necessary when userExposed is false!
1820 dupe.RootPart.IsAttachment = true; 1825
1821 1826 bool previousAttachmentStatus = dupe.RootPart.IsAttachment;
1822 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1827
1823 1828 if (!userExposed)
1824 if (!userExposed) 1829 dupe.RootPart.IsAttachment = true;
1825 { 1830
1826 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1831 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1827 } 1832
1828 1833 if (!userExposed)
1829 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1834 {
1830 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1835 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1831 1836 }
1832 if (userExposed) 1837
1833 dupe.m_rootPart.TrimPermissions(); 1838 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1834 1839 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1835 /// may need to create a new Physics actor. 1840
1836 if (dupe.RootPart.PhysActor != null && userExposed) 1841 if (userExposed)
1837 { 1842 dupe.m_rootPart.TrimPermissions();
1838 PrimitiveBaseShape pbs = dupe.RootPart.Shape; 1843
1839 1844 /// may need to create a new Physics actor.
1840 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( 1845 if (dupe.RootPart.PhysActor != null && userExposed)
1841 dupe.RootPart.Name, 1846 {
1842 pbs, 1847 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
1843 dupe.RootPart.AbsolutePosition, 1848
1844 dupe.RootPart.Scale, 1849 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1845 dupe.RootPart.RotationOffset, 1850 dupe.RootPart.Name,
1846 dupe.RootPart.PhysActor.IsPhysical); 1851 pbs,
1847 1852 dupe.RootPart.AbsolutePosition,
1848 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; 1853 dupe.RootPart.Scale,
1849 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 1854 dupe.RootPart.RotationOffset,
1855 dupe.RootPart.PhysActor.IsPhysical);
1856
1857 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
1858 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1859 }
1860
1861 List<SceneObjectPart> partList;
1862
1863 lockPartsForRead(true);
1864
1865 partList = new List<SceneObjectPart>(m_parts.Values);
1866
1867 lockPartsForRead(false);
1868
1869 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
1870 {
1871 return p1.LinkNum.CompareTo(p2.LinkNum);
1872 }
1873 );
1874
1875 foreach (SceneObjectPart part in partList)
1876 {
1877 if (part.UUID != m_rootPart.UUID)
1878 {
1879 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1880
1881 newPart.LinkNum = part.LinkNum;
1882 }
1883 }
1884
1885 if (userExposed)
1886 {
1887 dupe.UpdateParentIDs();
1888 dupe.HasGroupChanged = true;
1889 dupe.AttachToBackup();
1890
1891 ScheduleGroupForFullUpdate();
1892 }
1893 }
1894 finally
1895 {
1896 m_dupeInProgress = false;
1850 } 1897 }
1851
1852 List<SceneObjectPart> partList;
1853
1854 lockPartsForRead(true);
1855
1856 partList = new List<SceneObjectPart>(m_parts.Values);
1857
1858 lockPartsForRead(false);
1859
1860 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
1861 {
1862 return p1.LinkNum.CompareTo(p2.LinkNum);
1863 }
1864 );
1865
1866 foreach (SceneObjectPart part in partList)
1867 {
1868 if (part.UUID != m_rootPart.UUID)
1869 {
1870 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1871
1872 newPart.LinkNum = part.LinkNum;
1873 }
1874 }
1875
1876 if (userExposed)
1877 {
1878 dupe.UpdateParentIDs();
1879 dupe.HasGroupChanged = true;
1880 dupe.AttachToBackup();
1881
1882 ScheduleGroupForFullUpdate();
1883 }
1884
1885 return dupe; 1898 return dupe;
1886 } 1899 }
1887 1900
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b0ce450..77581af 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -718,17 +718,20 @@ namespace OpenSim.Region.Framework.Scenes
718 718
719 // Tell the physics engines that this prim changed. 719 // Tell the physics engines that this prim changed.
720 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 720 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
721 } 721 }
722 722
723 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); 723 if (!m_parentGroup.m_dupeInProgress)
724 foreach (ScenePresence av in avs) 724 {
725 { 725 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
726 if (av.LinkedPrim == m_uuid) 726 foreach (ScenePresence av in avs)
727 { 727 {
728 Vector3 offset = (m_offsetPosition - oldpos); 728 if (av.LinkedPrim == m_uuid)
729 av.OffsetPosition += offset; 729 {
730 av.SendFullUpdateToAllClients(); 730 Vector3 offset = (m_offsetPosition - oldpos);
731 } 731 av.OffsetPosition += offset;
732 av.SendFullUpdateToAllClients();
733 }
734 }
732 } 735 }
733 } 736 }
734 TriggerScriptChangedEvent(Changed.POSITION); 737 TriggerScriptChangedEvent(Changed.POSITION);