aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-07-19 04:05:34 +0000
committerMelanie Thielker2008-07-19 04:05:34 +0000
commitbcf74416a1677584c069e4e0b9acf9015d8c5b6c (patch)
tree8c0b967fafbc21e93974760c0b32a0dd2119b930 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parentIntroduce a separate connection string for estates, which defaults to the one gi (diff)
downloadopensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.zip
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.gz
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.bz2
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.xz
Fix prim link numbers (Mantis #1781)
Implements additional unlink modes (unlink root prim from link set, some multi-set operations). Linking (single and mutiple) fully implemented. Consistent numbering of links while in world. Link/delink with predictable link numbering. Correct link numbers in LSL. Not all multi-set ops implemented. Link numbers still change when taken and re-rezzed.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs46
1 files changed, 41 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 86e0caa..82e395d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -427,7 +427,10 @@ namespace OpenSim.Region.Environment.Scenes
427 if (reader.Name == "SceneObjectPart") 427 if (reader.Name == "SceneObjectPart")
428 { 428 {
429 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 429 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
430 if(m_rootPart.LinkNum == 0)
431 m_rootPart.LinkNum++;
430 AddPart(Part); 432 AddPart(Part);
433 Part.LinkNum = m_parts.Count;
431 Part.StoreUndoState(); 434 Part.StoreUndoState();
432 } 435 }
433 else 436 else
@@ -462,7 +465,7 @@ namespace OpenSim.Region.Environment.Scenes
462 LLVector3 rootOffset = new LLVector3(0, 0, 0); 465 LLVector3 rootOffset = new LLVector3(0, 0, 0);
463 SceneObjectPart newPart = 466 SceneObjectPart newPart =
464 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); 467 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset);
465 newPart.LinkNum = m_parts.Count; 468 newPart.LinkNum = 0;
466 m_parts.Add(newPart.UUID, newPart); 469 m_parts.Add(newPart.UUID, newPart);
467 SetPartAsRoot(newPart); 470 SetPartAsRoot(newPart);
468 471
@@ -817,7 +820,6 @@ namespace OpenSim.Region.Environment.Scenes
817 lock (m_parts) 820 lock (m_parts)
818 { 821 {
819 part.SetParent(this); 822 part.SetParent(this);
820 part.LinkNum = m_parts.Count;
821 823
822 try 824 try
823 { 825 {
@@ -828,6 +830,11 @@ namespace OpenSim.Region.Environment.Scenes
828 { 830 {
829 m_log.Error("Failed to add scened object part", e); 831 m_log.Error("Failed to add scened object part", e);
830 } 832 }
833
834 part.LinkNum = m_parts.Count;
835
836 if(part.LinkNum == 2 && RootPart != null)
837 RootPart.LinkNum = 1;
831 } 838 }
832 } 839 }
833 840
@@ -1738,14 +1745,16 @@ namespace OpenSim.Region.Environment.Scenes
1738 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 1745 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1739 1746
1740 linkPart.ParentID = m_rootPart.LocalId; 1747 linkPart.ParentID = m_rootPart.LocalId;
1741 1748 if(m_rootPart.LinkNum == 0)
1742 linkPart.LinkNum = m_parts.Count; 1749 m_rootPart.LinkNum = 1;
1743 1750
1744 lock (m_parts) 1751 lock (m_parts)
1745 { 1752 {
1746 m_parts.Add(linkPart.UUID, linkPart); 1753 m_parts.Add(linkPart.UUID, linkPart);
1747 } 1754 }
1748 1755
1756 linkPart.LinkNum = m_parts.Count;
1757
1749 linkPart.SetParent(this); 1758 linkPart.SetParent(this);
1750 1759
1751 //if (linkPart.PhysActor != null) 1760 //if (linkPart.PhysActor != null)
@@ -1784,6 +1793,11 @@ namespace OpenSim.Region.Environment.Scenes
1784 /// <param name="partID"></param> 1793 /// <param name="partID"></param>
1785 public void DelinkFromGroup(uint partID) 1794 public void DelinkFromGroup(uint partID)
1786 { 1795 {
1796 DelinkFromGroup(partID, true);
1797 }
1798
1799 public void DelinkFromGroup(uint partID, bool sendEvents)
1800 {
1787 SceneObjectPart linkPart = GetChildPart(partID); 1801 SceneObjectPart linkPart = GetChildPart(partID);
1788 1802
1789 if (null != linkPart) 1803 if (null != linkPart)
@@ -1801,7 +1815,17 @@ namespace OpenSim.Region.Environment.Scenes
1801 m_parts.Remove(linkPart.UUID); 1815 m_parts.Remove(linkPart.UUID);
1802 } 1816 }
1803 1817
1818 if(m_parts.Count == 1 && RootPart != null) //Single prim is left
1819 RootPart.LinkNum = 0;
1820 else
1821 {
1822 foreach (SceneObjectPart p in m_parts.Values)
1823 if(p.LinkNum > linkPart.LinkNum)
1824 p.LinkNum--;
1825 }
1826
1804 linkPart.ParentID = 0; 1827 linkPart.ParentID = 0;
1828 linkPart.LinkNum = 0;
1805 1829
1806 if (linkPart.PhysActor != null) 1830 if (linkPart.PhysActor != null)
1807 { 1831 {
@@ -1834,6 +1858,9 @@ namespace OpenSim.Region.Environment.Scenes
1834 1858
1835 m_scene.AddNewSceneObject(objectGroup, true); 1859 m_scene.AddNewSceneObject(objectGroup, true);
1836 1860
1861 if(sendEvents)
1862 linkPart.TriggerScriptChangedEvent(Changed.LINK);
1863
1837 HasGroupChanged = true; 1864 HasGroupChanged = true;
1838 ScheduleGroupForFullUpdate(); 1865 ScheduleGroupForFullUpdate();
1839 } 1866 }
@@ -1858,13 +1885,14 @@ namespace OpenSim.Region.Environment.Scenes
1858 { 1885 {
1859 part.SetParent(this); 1886 part.SetParent(this);
1860 part.ParentID = m_rootPart.LocalId; 1887 part.ParentID = m_rootPart.LocalId;
1861 part.LinkNum = m_parts.Count;
1862 1888
1863 lock (m_parts) 1889 lock (m_parts)
1864 { 1890 {
1865 m_parts.Add(part.UUID, part); 1891 m_parts.Add(part.UUID, part);
1866 } 1892 }
1867 1893
1894 part.LinkNum = m_parts.Count;
1895
1868 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1896 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
1869 axiomOldPos = oldGroupRotation * axiomOldPos; 1897 axiomOldPos = oldGroupRotation * axiomOldPos;
1870 axiomOldPos += oldGroupPosition; 1898 axiomOldPos += oldGroupPosition;
@@ -2670,5 +2698,13 @@ namespace OpenSim.Region.Environment.Scenes
2670 2698
2671 ScheduleGroupForFullUpdate(); 2699 ScheduleGroupForFullUpdate();
2672 } 2700 }
2701
2702 public void TriggerScriptChangedEvent(Changed val)
2703 {
2704 foreach (SceneObjectPart part in Children.Values)
2705 {
2706 part.TriggerScriptChangedEvent(val);
2707 }
2708 }
2673 } 2709 }
2674} 2710}