From 1b56fff7c8ca3a3e14e576ecb0137d9d34997205 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Thu, 9 Apr 2009 10:07:40 +0000
Subject: * Implements retrieving child primitives via World.Objects[id] (MRM)
* Optimizes SceneGraph - fetches on primitives via "GetGroupByPrim" wont
search the entire list if the primitive is infact the root. (Core) * Updates
Test MRM.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +++
.../OptionalModules/Scripting/Minimodule/SOPObject.cs | 5 +----
.../OptionalModules/Scripting/Minimodule/Test/TestModule.cs | 13 ++++++++++++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index d6aca31..c2f9fd2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -860,6 +860,9 @@ namespace OpenSim.Region.Framework.Scenes
/// null if no scene object group containing that prim is found
private SceneObjectGroup GetGroupByPrim(uint localID)
{
+ if (Entities.ContainsKey(localID))
+ return Entities[localID] as SceneObjectGroup;
+
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
List EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 4734fa9..75ec33a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -53,10 +53,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
///
private SceneObjectPart GetSOP()
{
- if (m_rootScene.Entities.ContainsKey(m_localID))
- return ((SceneObjectGroup) m_rootScene.Entities[m_localID]).RootPart;
-
- return null;
+ return m_rootScene.GetSceneObjectPart(m_localID);
}
#region OnTouch
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs
index e56d5eb..702ac74 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs
@@ -33,7 +33,18 @@ namespace OpenSim
{
public override void Start()
{
- Host.Console.Info("Hello World!");
+ // Say Hello
+ Host.Object.Say("Hello, Avatar!");
+
+ // Register ourselves to listen
+ // for touch events.
+ Host.Object.OnTouch += OnTouched;
+ }
+
+ // This is our touch event handler
+ void OnTouched(IObject sender, TouchEventArgs e)
+ {
+ Host.Object.Say("Touched.");
}
public override void Stop()
--
cgit v1.1