From 7ed419217fc63f7a01c13a7c3320e97edd6bb1b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 20 May 2011 23:22:27 +0100 Subject: add test for rezzing an object from a prim item --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc31b65..14b587f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -344,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes /// Add an object to the scene. This will both update the scene, and send information about the /// new object to all clients interested in the scene. /// + /// + /// The object's stored position, rotation and velocity are used. + /// /// /// /// If true, the object is made persistent into the scene. -- cgit v1.1 From 91a9f30b1613fba8c3ff31de5b9390b0e636ad65 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 20 May 2011 23:34:34 +0100 Subject: implement Scene.GetSceneObjectGroup(UUID fullID) using existing index --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 14b587f..2d547f7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -976,6 +976,22 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Get a group in the scene + /// + /// UUID of the group + /// null if no such group was found + protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID) + { + lock (SceneObjectGroupsByFullID) + { + if (SceneObjectGroupsByFullID.ContainsKey(fullID)) + return SceneObjectGroupsByFullID[fullID]; + } + + return null; + } + + /// /// Get a part contained in this scene. /// /// -- cgit v1.1 From 4b0fc4faef657cc819dfa360fb6a266532724455 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 20 May 2011 23:41:14 +0100 Subject: implement Scene.GetSceneObjectGroup(string name) to match the equivalent GetSOP method --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2d547f7..0cff011 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -992,6 +992,35 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Get a group by name from the 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 SceneObjectGroup GetSceneObjectGroup(string name) + { + SceneObjectGroup so = null; + + Entities.Find( + delegate(EntityBase entity) + { + if (entity is SceneObjectGroup) + { + if (entity.Name == name) + { + so = (SceneObjectGroup)entity; + return true; + } + } + + return false; + } + ); + + return so; + } + + /// /// Get a part contained in this scene. /// /// @@ -1005,7 +1034,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a named prim contained in this scene (will return the first + /// Get a prim by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// /// -- cgit v1.1 From 90567a9eaac717ab86316c078e148f8fe13432ac Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 21 May 2011 00:02:53 +0100 Subject: refactor Scene.RezObject() to use AddNewSceneObject() rather than copy/pasting code with small differences --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0cff011..cdb4e41 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -311,25 +311,26 @@ namespace OpenSim.Region.Framework.Scenes /// This method does not send updates to the client - callers need to handle this themselves. /// /// - /// Position of the object - /// Rotation of the object + /// Position of the object. If null then the position stored in the object is used. + /// Rotation of the object. If null then the rotation stored in the object is used. /// Velocity of the object. This parameter only has an effect if the object is physical /// public bool AddNewSceneObject( - SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) + SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { AddNewSceneObject(sceneObject, true, false); - // we set it's position in world. - sceneObject.AbsolutePosition = pos; + if (pos != null) + sceneObject.AbsolutePosition = (Vector3)pos; if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) { sceneObject.ClearPartAttachmentData(); } - - sceneObject.UpdateGroupRotationR(rot); - + + if (rot != null) + sceneObject.UpdateGroupRotationR((Quaternion)rot); + //group.ApplyPhysics(m_physicalPrim); if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) { -- cgit v1.1