From 8e8c26acac73cc50d43976fe58ba8fcdaa4afe33 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Mon, 17 Dec 2007 02:30:03 +0000
Subject: 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)
---
.../Region/Environment/Scenes/SceneObjectGroup.cs | 41 ++++++++++++++++++----
.../Region/Environment/Scenes/SceneObjectPart.cs | 7 ++++
2 files changed, 41 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
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
///
public int PrimCount
{
- get { return 1; }
+ get { return m_parts.Count; }
}
public LLQuaternion GroupRotation
@@ -240,8 +240,9 @@ namespace OpenSim.Region.Environment.Scenes
m_scene = scene;
part.SetParent(this);
part.ParentID = 0;
-
+ part.LinkNum = 0;
m_parts.Add(part.UUID, part);
+
SetPartAsRoot(part);
RegionHandle = regionHandle;
@@ -267,7 +268,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.ReadStartElement("SceneObjectGroup");
reader.ReadStartElement("RootPart");
m_rootPart = SceneObjectPart.FromXml(reader);
-
+ AddPart(m_rootPart);
reader.ReadEndElement();
while (reader.Read())
@@ -293,7 +294,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Close();
sr.Close();
- AddPart(m_rootPart);
+
m_rootPart.LocalID = m_scene.PrimIDAllocate();
m_rootPart.ParentID = 0;
@@ -318,6 +319,10 @@ namespace OpenSim.Region.Environment.Scenes
reader.ReadStartElement("SceneObjectGroup");
m_rootPart = SceneObjectPart.FromXml(reader);
+ m_rootPart.SetParent(this);
+ m_parts.Add(m_rootPart.UUID, m_rootPart);
+ m_rootPart.ParentID = 0;
+ m_rootPart.LinkNum = 0;
reader.Read();
bool more = true;
@@ -346,9 +351,7 @@ namespace OpenSim.Region.Environment.Scenes
}
reader.Close();
sr.Close();
- m_rootPart.SetParent(this);
- m_parts.Add(m_rootPart.UUID, m_rootPart);
- m_rootPart.ParentID = 0;
+
UpdateParentIDs();
ScheduleGroupForFullUpdate();
@@ -431,6 +434,7 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 rootOffset = new LLVector3(0, 0, 0);
SceneObjectPart newPart =
new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset);
+ newPart.LinkNum = m_parts.Count;
m_parts.Add(newPart.UUID, newPart);
SetPartAsRoot(newPart);
@@ -586,6 +590,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID);
newPart.SetParent(this);
+ newPart.LinkNum = m_parts.Count;
m_parts.Add(newPart.UUID, newPart);
SetPartAsRoot(newPart);
}
@@ -615,6 +620,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID);
newPart.SetParent(this);
+ newPart.LinkNum = m_parts.Count;
m_parts.Add(newPart.UUID, newPart);
SetPartAsNonRoot(newPart);
}
@@ -627,6 +633,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in partsList)
{
part.UUID = LLUUID.Random();
+ part.LinkNum = m_parts.Count;
m_parts.Add(part.UUID, part);
}
}
@@ -770,6 +777,23 @@ namespace OpenSim.Region.Environment.Scenes
#region SceneGroupPart Methods
///
+ /// Get the child part by LinkNum
+ ///
+ ///
+ /// null if no child part with that linknum or child part
+ public SceneObjectPart GetLinkNumPart(int linknum)
+ {
+ foreach (SceneObjectPart part in m_parts.Values)
+ {
+ if (part.LinkNum == linknum)
+ {
+ return part;
+ }
+ }
+ return null;
+ }
+
+ ///
/// Get a child part with a given UUID
///
///
@@ -868,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes
Quaternion newRot = parentRot.Inverse() * oldRot;
linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
linkPart.ParentID = m_rootPart.LocalID;
+ linkPart.LinkNum = m_parts.Count;
m_parts.Add(linkPart.UUID, linkPart);
linkPart.SetParent(this);
@@ -979,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes
{
part.SetParent(this);
part.ParentID = m_rootPart.LocalID;
+ part.LinkNum = m_parts.Count;
m_parts.Add(part.UUID, part);
Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
@@ -1612,6 +1638,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddPart(SceneObjectPart part)
{
part.SetParent(this);
+ part.LinkNum = m_parts.Count;
m_parts.Add(part.UUID, part);
}
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
set { m_touchName = value; }
}
+ private int m_linkNum = 0;
+ public int LinkNum
+ {
+ get { return m_linkNum; }
+ set { m_linkNum = value; }
+ }
+
private byte m_clickAction = 0;
public byte ClickAction
{
--
cgit v1.1