diff options
author | Charles Krinke | 2007-12-17 02:30:03 +0000 |
---|---|---|
committer | Charles Krinke | 2007-12-17 02:30:03 +0000 |
commit | 8e8c26acac73cc50d43976fe58ba8fcdaa4afe33 (patch) | |
tree | c7b4edece68b2c1549e665f7e27936279afb531f /OpenSim/Region/Environment/Scenes | |
parent | The "Got a packet from an invalid client" has served its purpose (diff) | |
download | opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.zip opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.gz opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.bz2 opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.xz |
Again, thanks to Alondria for:
Added: LinkNum to SceneObjectPart
Added: Bunch-o settings of LinkNum in SceneObjectGroup
Added: llGetNumberOfPrims()
Added: llGetLinkNumber()
Added: llGetLinkKey()
Added: llGetLinkName() (and change to string return type)
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 7 |
2 files changed, 41 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index e44705c..263ac27 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | /// </summary> | 67 | /// </summary> |
68 | public int PrimCount | 68 | public int PrimCount |
69 | { | 69 | { |
70 | get { return 1; } | 70 | get { return m_parts.Count; } |
71 | } | 71 | } |
72 | 72 | ||
73 | public LLQuaternion GroupRotation | 73 | public LLQuaternion GroupRotation |
@@ -240,8 +240,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
240 | m_scene = scene; | 240 | m_scene = scene; |
241 | part.SetParent(this); | 241 | part.SetParent(this); |
242 | part.ParentID = 0; | 242 | part.ParentID = 0; |
243 | 243 | part.LinkNum = 0; | |
244 | m_parts.Add(part.UUID, part); | 244 | m_parts.Add(part.UUID, part); |
245 | |||
245 | SetPartAsRoot(part); | 246 | SetPartAsRoot(part); |
246 | 247 | ||
247 | RegionHandle = regionHandle; | 248 | RegionHandle = regionHandle; |
@@ -267,7 +268,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | reader.ReadStartElement("SceneObjectGroup"); | 268 | reader.ReadStartElement("SceneObjectGroup"); |
268 | reader.ReadStartElement("RootPart"); | 269 | reader.ReadStartElement("RootPart"); |
269 | m_rootPart = SceneObjectPart.FromXml(reader); | 270 | m_rootPart = SceneObjectPart.FromXml(reader); |
270 | 271 | AddPart(m_rootPart); | |
271 | reader.ReadEndElement(); | 272 | reader.ReadEndElement(); |
272 | 273 | ||
273 | while (reader.Read()) | 274 | while (reader.Read()) |
@@ -293,7 +294,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
293 | reader.Close(); | 294 | reader.Close(); |
294 | sr.Close(); | 295 | sr.Close(); |
295 | 296 | ||
296 | AddPart(m_rootPart); | 297 | |
297 | 298 | ||
298 | m_rootPart.LocalID = m_scene.PrimIDAllocate(); | 299 | m_rootPart.LocalID = m_scene.PrimIDAllocate(); |
299 | m_rootPart.ParentID = 0; | 300 | m_rootPart.ParentID = 0; |
@@ -318,6 +319,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
318 | 319 | ||
319 | reader.ReadStartElement("SceneObjectGroup"); | 320 | reader.ReadStartElement("SceneObjectGroup"); |
320 | m_rootPart = SceneObjectPart.FromXml(reader); | 321 | m_rootPart = SceneObjectPart.FromXml(reader); |
322 | m_rootPart.SetParent(this); | ||
323 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
324 | m_rootPart.ParentID = 0; | ||
325 | m_rootPart.LinkNum = 0; | ||
321 | 326 | ||
322 | reader.Read(); | 327 | reader.Read(); |
323 | bool more = true; | 328 | bool more = true; |
@@ -346,9 +351,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | } | 351 | } |
347 | reader.Close(); | 352 | reader.Close(); |
348 | sr.Close(); | 353 | sr.Close(); |
349 | m_rootPart.SetParent(this); | 354 | |
350 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
351 | m_rootPart.ParentID = 0; | ||
352 | UpdateParentIDs(); | 355 | UpdateParentIDs(); |
353 | 356 | ||
354 | ScheduleGroupForFullUpdate(); | 357 | ScheduleGroupForFullUpdate(); |
@@ -431,6 +434,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
431 | LLVector3 rootOffset = new LLVector3(0, 0, 0); | 434 | LLVector3 rootOffset = new LLVector3(0, 0, 0); |
432 | SceneObjectPart newPart = | 435 | SceneObjectPart newPart = |
433 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); | 436 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); |
437 | newPart.LinkNum = m_parts.Count; | ||
434 | m_parts.Add(newPart.UUID, newPart); | 438 | m_parts.Add(newPart.UUID, newPart); |
435 | SetPartAsRoot(newPart); | 439 | SetPartAsRoot(newPart); |
436 | 440 | ||
@@ -586,6 +590,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
586 | { | 590 | { |
587 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); | 591 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); |
588 | newPart.SetParent(this); | 592 | newPart.SetParent(this); |
593 | newPart.LinkNum = m_parts.Count; | ||
589 | m_parts.Add(newPart.UUID, newPart); | 594 | m_parts.Add(newPart.UUID, newPart); |
590 | SetPartAsRoot(newPart); | 595 | SetPartAsRoot(newPart); |
591 | } | 596 | } |
@@ -615,6 +620,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | { | 620 | { |
616 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); | 621 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); |
617 | newPart.SetParent(this); | 622 | newPart.SetParent(this); |
623 | newPart.LinkNum = m_parts.Count; | ||
618 | m_parts.Add(newPart.UUID, newPart); | 624 | m_parts.Add(newPart.UUID, newPart); |
619 | SetPartAsNonRoot(newPart); | 625 | SetPartAsNonRoot(newPart); |
620 | } | 626 | } |
@@ -627,6 +633,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
627 | foreach (SceneObjectPart part in partsList) | 633 | foreach (SceneObjectPart part in partsList) |
628 | { | 634 | { |
629 | part.UUID = LLUUID.Random(); | 635 | part.UUID = LLUUID.Random(); |
636 | part.LinkNum = m_parts.Count; | ||
630 | m_parts.Add(part.UUID, part); | 637 | m_parts.Add(part.UUID, part); |
631 | } | 638 | } |
632 | } | 639 | } |
@@ -770,6 +777,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
770 | #region SceneGroupPart Methods | 777 | #region SceneGroupPart Methods |
771 | 778 | ||
772 | /// <summary> | 779 | /// <summary> |
780 | /// Get the child part by LinkNum | ||
781 | /// </summary> | ||
782 | /// <param name="linknum"></param> | ||
783 | /// <returns>null if no child part with that linknum or child part</returns> | ||
784 | public SceneObjectPart GetLinkNumPart(int linknum) | ||
785 | { | ||
786 | foreach (SceneObjectPart part in m_parts.Values) | ||
787 | { | ||
788 | if (part.LinkNum == linknum) | ||
789 | { | ||
790 | return part; | ||
791 | } | ||
792 | } | ||
793 | return null; | ||
794 | } | ||
795 | |||
796 | /// <summary> | ||
773 | /// Get a child part with a given UUID | 797 | /// Get a child part with a given UUID |
774 | /// </summary> | 798 | /// </summary> |
775 | /// <param name="primID"></param> | 799 | /// <param name="primID"></param> |
@@ -868,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
868 | Quaternion newRot = parentRot.Inverse() * oldRot; | 892 | Quaternion newRot = parentRot.Inverse() * oldRot; |
869 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 893 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
870 | linkPart.ParentID = m_rootPart.LocalID; | 894 | linkPart.ParentID = m_rootPart.LocalID; |
895 | linkPart.LinkNum = m_parts.Count; | ||
871 | m_parts.Add(linkPart.UUID, linkPart); | 896 | m_parts.Add(linkPart.UUID, linkPart); |
872 | linkPart.SetParent(this); | 897 | linkPart.SetParent(this); |
873 | 898 | ||
@@ -979,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
979 | { | 1004 | { |
980 | part.SetParent(this); | 1005 | part.SetParent(this); |
981 | part.ParentID = m_rootPart.LocalID; | 1006 | part.ParentID = m_rootPart.LocalID; |
1007 | part.LinkNum = m_parts.Count; | ||
982 | m_parts.Add(part.UUID, part); | 1008 | m_parts.Add(part.UUID, part); |
983 | 1009 | ||
984 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); | 1010 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); |
@@ -1612,6 +1638,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1612 | public void AddPart(SceneObjectPart part) | 1638 | public void AddPart(SceneObjectPart part) |
1613 | { | 1639 | { |
1614 | part.SetParent(this); | 1640 | part.SetParent(this); |
1641 | part.LinkNum = m_parts.Count; | ||
1615 | m_parts.Add(part.UUID, part); | 1642 | m_parts.Add(part.UUID, part); |
1616 | } | 1643 | } |
1617 | 1644 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index f6c0ee3..5e5b8b5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -364,6 +364,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
364 | set { m_touchName = value; } | 364 | set { m_touchName = value; } |
365 | } | 365 | } |
366 | 366 | ||
367 | private int m_linkNum = 0; | ||
368 | public int LinkNum | ||
369 | { | ||
370 | get { return m_linkNum; } | ||
371 | set { m_linkNum = value; } | ||
372 | } | ||
373 | |||
367 | private byte m_clickAction = 0; | 374 | private byte m_clickAction = 0; |
368 | public byte ClickAction | 375 | public byte ClickAction |
369 | { | 376 | { |