diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 67 |
1 files changed, 58 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc31b65..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 | |||
311 | /// This method does not send updates to the client - callers need to handle this themselves. | 311 | /// This method does not send updates to the client - callers need to handle this themselves. |
312 | /// <param name="sceneObject"></param> | 312 | /// <param name="sceneObject"></param> |
313 | /// <param name="attachToBackup"></param> | 313 | /// <param name="attachToBackup"></param> |
314 | /// <param name="pos">Position of the object</param> | 314 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
315 | /// <param name="rot">Rotation of the object</param> | 315 | /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param> |
316 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 316 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
317 | /// <returns></returns> | 317 | /// <returns></returns> |
318 | public bool AddNewSceneObject( | 318 | public bool AddNewSceneObject( |
319 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 319 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
320 | { | 320 | { |
321 | AddNewSceneObject(sceneObject, true, false); | 321 | AddNewSceneObject(sceneObject, true, false); |
322 | 322 | ||
323 | // we set it's position in world. | 323 | if (pos != null) |
324 | sceneObject.AbsolutePosition = pos; | 324 | sceneObject.AbsolutePosition = (Vector3)pos; |
325 | 325 | ||
326 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | 326 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) |
327 | { | 327 | { |
328 | sceneObject.ClearPartAttachmentData(); | 328 | sceneObject.ClearPartAttachmentData(); |
329 | } | 329 | } |
330 | 330 | ||
331 | sceneObject.UpdateGroupRotationR(rot); | 331 | if (rot != null) |
332 | 332 | sceneObject.UpdateGroupRotationR((Quaternion)rot); | |
333 | |||
333 | //group.ApplyPhysics(m_physicalPrim); | 334 | //group.ApplyPhysics(m_physicalPrim); |
334 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | 335 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) |
335 | { | 336 | { |
@@ -344,6 +345,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
344 | /// Add an object to the scene. This will both update the scene, and send information about the | 345 | /// Add an object to the scene. This will both update the scene, and send information about the |
345 | /// new object to all clients interested in the scene. | 346 | /// new object to all clients interested in the scene. |
346 | /// </summary> | 347 | /// </summary> |
348 | /// <remarks> | ||
349 | /// The object's stored position, rotation and velocity are used. | ||
350 | /// </remarks> | ||
347 | /// <param name="sceneObject"></param> | 351 | /// <param name="sceneObject"></param> |
348 | /// <param name="attachToBackup"> | 352 | /// <param name="attachToBackup"> |
349 | /// If true, the object is made persistent into the scene. | 353 | /// If true, the object is made persistent into the scene. |
@@ -973,6 +977,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
973 | } | 977 | } |
974 | 978 | ||
975 | /// <summary> | 979 | /// <summary> |
980 | /// Get a group in the scene | ||
981 | /// </summary> | ||
982 | /// <param name="fullID">UUID of the group</param> | ||
983 | /// <returns>null if no such group was found</returns> | ||
984 | protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID) | ||
985 | { | ||
986 | lock (SceneObjectGroupsByFullID) | ||
987 | { | ||
988 | if (SceneObjectGroupsByFullID.ContainsKey(fullID)) | ||
989 | return SceneObjectGroupsByFullID[fullID]; | ||
990 | } | ||
991 | |||
992 | return null; | ||
993 | } | ||
994 | |||
995 | /// <summary> | ||
996 | /// Get a group by name from the scene (will return the first | ||
997 | /// found, if there are more than one prim with the same name) | ||
998 | /// </summary> | ||
999 | /// <param name="name"></param> | ||
1000 | /// <returns>null if the part was not found</returns> | ||
1001 | protected internal SceneObjectGroup GetSceneObjectGroup(string name) | ||
1002 | { | ||
1003 | SceneObjectGroup so = null; | ||
1004 | |||
1005 | Entities.Find( | ||
1006 | delegate(EntityBase entity) | ||
1007 | { | ||
1008 | if (entity is SceneObjectGroup) | ||
1009 | { | ||
1010 | if (entity.Name == name) | ||
1011 | { | ||
1012 | so = (SceneObjectGroup)entity; | ||
1013 | return true; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | return false; | ||
1018 | } | ||
1019 | ); | ||
1020 | |||
1021 | return so; | ||
1022 | } | ||
1023 | |||
1024 | /// <summary> | ||
976 | /// Get a part contained in this scene. | 1025 | /// Get a part contained in this scene. |
977 | /// </summary> | 1026 | /// </summary> |
978 | /// <param name="localID"></param> | 1027 | /// <param name="localID"></param> |
@@ -986,7 +1035,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
986 | } | 1035 | } |
987 | 1036 | ||
988 | /// <summary> | 1037 | /// <summary> |
989 | /// Get a named prim contained in this scene (will return the first | 1038 | /// Get a prim by name from the scene (will return the first |
990 | /// found, if there are more than one prim with the same name) | 1039 | /// found, if there are more than one prim with the same name) |
991 | /// </summary> | 1040 | /// </summary> |
992 | /// <param name="name"></param> | 1041 | /// <param name="name"></param> |