diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 208 |
1 files changed, 104 insertions, 104 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3c3f4b7..a862fa2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -317,7 +317,7 @@ 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 | public bool m_dupeInProgress = false; | 321 | public bool m_dupeInProgress = false; |
322 | internal Dictionary<UUID, string> m_savedScriptState = null; | 322 | internal Dictionary<UUID, string> m_savedScriptState = null; |
323 | 323 | ||
@@ -475,21 +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 | if (!m_dupeInProgress) | 479 | if (!m_dupeInProgress) |
480 | { | 480 | { |
481 | part.TriggerScriptChangedEvent(Changed.POSITION); | 481 | part.TriggerScriptChangedEvent(Changed.POSITION); |
482 | } | ||
483 | } | ||
484 | if (!m_dupeInProgress) | ||
485 | { | ||
486 | foreach (ScenePresence av in m_linkedAvatars) | ||
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(); | ||
482 | } | 492 | } |
483 | } | ||
484 | if (!m_dupeInProgress) | ||
485 | { | ||
486 | foreach (ScenePresence av in m_linkedAvatars) | ||
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 | } | ||
493 | } | 493 | } |
494 | 494 | ||
495 | //if (m_rootPart.PhysActor != null) | 495 | //if (m_rootPart.PhysActor != null) |
@@ -1805,95 +1805,95 @@ namespace OpenSim.Region.Framework.Scenes | |||
1805 | /// <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> |
1806 | /// <returns></returns> | 1806 | /// <returns></returns> |
1807 | public SceneObjectGroup Copy(bool userExposed) | 1807 | public SceneObjectGroup Copy(bool userExposed) |
1808 | { | 1808 | { |
1809 | SceneObjectGroup dupe; | 1809 | SceneObjectGroup dupe; |
1810 | try | 1810 | try |
1811 | { | 1811 | { |
1812 | m_dupeInProgress = true; | 1812 | m_dupeInProgress = true; |
1813 | dupe = (SceneObjectGroup)MemberwiseClone(); | 1813 | dupe = (SceneObjectGroup)MemberwiseClone(); |
1814 | dupe.m_isBackedUp = false; | 1814 | dupe.m_isBackedUp = false; |
1815 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); | 1815 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); |
1816 | 1816 | ||
1817 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1817 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
1818 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 1818 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
1819 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 1819 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! |
1820 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | 1820 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state |
1821 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | 1821 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, |
1822 | // then restore it's attachment state | 1822 | // then restore it's attachment state |
1823 | 1823 | ||
1824 | // This is only necessary when userExposed is false! | 1824 | // This is only necessary when userExposed is false! |
1825 | 1825 | ||
1826 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | 1826 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; |
1827 | 1827 | ||
1828 | if (!userExposed) | 1828 | if (!userExposed) |
1829 | dupe.RootPart.IsAttachment = true; | 1829 | dupe.RootPart.IsAttachment = true; |
1830 | 1830 | ||
1831 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1831 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1832 | 1832 | ||
1833 | if (!userExposed) | 1833 | if (!userExposed) |
1834 | { | 1834 | { |
1835 | dupe.RootPart.IsAttachment = previousAttachmentStatus; | 1835 | dupe.RootPart.IsAttachment = previousAttachmentStatus; |
1836 | } | 1836 | } |
1837 | 1837 | ||
1838 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1838 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
1839 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 1839 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
1840 | 1840 | ||
1841 | if (userExposed) | 1841 | if (userExposed) |
1842 | dupe.m_rootPart.TrimPermissions(); | 1842 | dupe.m_rootPart.TrimPermissions(); |
1843 | 1843 | ||
1844 | /// may need to create a new Physics actor. | 1844 | /// may need to create a new Physics actor. |
1845 | if (dupe.RootPart.PhysActor != null && userExposed) | 1845 | if (dupe.RootPart.PhysActor != null && userExposed) |
1846 | { | 1846 | { |
1847 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; | 1847 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; |
1848 | 1848 | ||
1849 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( | 1849 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( |
1850 | dupe.RootPart.Name, | 1850 | dupe.RootPart.Name, |
1851 | pbs, | 1851 | pbs, |
1852 | dupe.RootPart.AbsolutePosition, | 1852 | dupe.RootPart.AbsolutePosition, |
1853 | dupe.RootPart.Scale, | 1853 | dupe.RootPart.Scale, |
1854 | dupe.RootPart.RotationOffset, | 1854 | dupe.RootPart.RotationOffset, |
1855 | dupe.RootPart.PhysActor.IsPhysical); | 1855 | dupe.RootPart.PhysActor.IsPhysical); |
1856 | 1856 | ||
1857 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; | 1857 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; |
1858 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); | 1858 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | List<SceneObjectPart> partList; | 1861 | List<SceneObjectPart> partList; |
1862 | 1862 | ||
1863 | lockPartsForRead(true); | 1863 | lockPartsForRead(true); |
1864 | 1864 | ||
1865 | partList = new List<SceneObjectPart>(m_parts.Values); | 1865 | partList = new List<SceneObjectPart>(m_parts.Values); |
1866 | 1866 | ||
1867 | lockPartsForRead(false); | 1867 | lockPartsForRead(false); |
1868 | 1868 | ||
1869 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | 1869 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) |
1870 | { | 1870 | { |
1871 | return p1.LinkNum.CompareTo(p2.LinkNum); | 1871 | return p1.LinkNum.CompareTo(p2.LinkNum); |
1872 | } | 1872 | } |
1873 | ); | 1873 | ); |
1874 | 1874 | ||
1875 | foreach (SceneObjectPart part in partList) | 1875 | foreach (SceneObjectPart part in partList) |
1876 | { | 1876 | { |
1877 | if (part.UUID != m_rootPart.UUID) | 1877 | if (part.UUID != m_rootPart.UUID) |
1878 | { | 1878 | { |
1879 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | 1879 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); |
1880 | 1880 | ||
1881 | newPart.LinkNum = part.LinkNum; | 1881 | newPart.LinkNum = part.LinkNum; |
1882 | } | 1882 | } |
1883 | } | 1883 | } |
1884 | 1884 | ||
1885 | if (userExposed) | 1885 | if (userExposed) |
1886 | { | 1886 | { |
1887 | dupe.UpdateParentIDs(); | 1887 | dupe.UpdateParentIDs(); |
1888 | dupe.HasGroupChanged = true; | 1888 | dupe.HasGroupChanged = true; |
1889 | dupe.AttachToBackup(); | 1889 | dupe.AttachToBackup(); |
1890 | 1890 | ||
1891 | ScheduleGroupForFullUpdate(); | 1891 | ScheduleGroupForFullUpdate(); |
1892 | } | 1892 | } |
1893 | } | 1893 | } |
1894 | finally | 1894 | finally |
1895 | { | 1895 | { |
1896 | m_dupeInProgress = false; | 1896 | m_dupeInProgress = false; |
1897 | } | 1897 | } |
1898 | return dupe; | 1898 | return dupe; |
1899 | } | 1899 | } |