From 513ce9caee7bbacc167c1f3241e64e201ac412cf Mon Sep 17 00:00:00 2001 From: Johan Berntsson Date: Wed, 1 Oct 2008 06:39:36 +0000 Subject: [PATCH] Added functions to find prims by name --- .../Region/Environment/Scenes/InnerScene.cs | 26 +++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 11 ++++++++ 2 files changed, 37 insertions(+) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index cd5a9f5a0d..3be1592ec7 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -821,6 +821,32 @@ namespace OpenSim.Region.Environment.Scenes else return null; } + + /// + /// Get a named prim contained in this scene (will return the first + /// found, if there are more than one prim with the same name) + /// + /// + /// null if the part was not found + protected internal SceneObjectPart GetSceneObjectPart(string name) + { + List EntityList = GetEntities(); + + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + foreach(SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) + { + if (p.Name==name) + { + return p; + } + } + } + } + return null; + } /// /// Get a part contained in this scene. diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 3799259a54..bbc50e67c2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -3882,6 +3882,17 @@ namespace OpenSim.Region.Environment.Scenes // } // } + /// + /// Get a named prim contained in this scene (will return the first + /// found, if there are more than one prim with the same name) + /// + /// + /// + public SceneObjectPart GetSceneObjectPart(string name) + { + return m_innerScene.GetSceneObjectPart(name); + } + /// /// ///