diff options
Diffstat (limited to '')
-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 3d6057b..c0236f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -352,25 +352,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
352 | /// This method does not send updates to the client - callers need to handle this themselves. | 352 | /// This method does not send updates to the client - callers need to handle this themselves. |
353 | /// <param name="sceneObject"></param> | 353 | /// <param name="sceneObject"></param> |
354 | /// <param name="attachToBackup"></param> | 354 | /// <param name="attachToBackup"></param> |
355 | /// <param name="pos">Position of the object</param> | 355 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
356 | /// <param name="rot">Rotation of the object</param> | 356 | /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param> |
357 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 357 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
358 | /// <returns></returns> | 358 | /// <returns></returns> |
359 | public bool AddNewSceneObject( | 359 | public bool AddNewSceneObject( |
360 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 360 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
361 | { | 361 | { |
362 | AddNewSceneObject(sceneObject, true, false); | 362 | AddNewSceneObject(sceneObject, true, false); |
363 | 363 | ||
364 | // we set it's position in world. | 364 | if (pos != null) |
365 | sceneObject.AbsolutePosition = pos; | 365 | sceneObject.AbsolutePosition = (Vector3)pos; |
366 | 366 | ||
367 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | 367 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) |
368 | { | 368 | { |
369 | sceneObject.ClearPartAttachmentData(); | 369 | sceneObject.ClearPartAttachmentData(); |
370 | } | 370 | } |
371 | 371 | ||
372 | sceneObject.UpdateGroupRotationR(rot); | 372 | if (rot != null) |
373 | 373 | sceneObject.UpdateGroupRotationR((Quaternion)rot); | |
374 | |||
374 | //group.ApplyPhysics(m_physicalPrim); | 375 | //group.ApplyPhysics(m_physicalPrim); |
375 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | 376 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) |
376 | { | 377 | { |
@@ -385,6 +386,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
385 | /// Add an object to the scene. This will both update the scene, and send information about the | 386 | /// Add an object to the scene. This will both update the scene, and send information about the |
386 | /// new object to all clients interested in the scene. | 387 | /// new object to all clients interested in the scene. |
387 | /// </summary> | 388 | /// </summary> |
389 | /// <remarks> | ||
390 | /// The object's stored position, rotation and velocity are used. | ||
391 | /// </remarks> | ||
388 | /// <param name="sceneObject"></param> | 392 | /// <param name="sceneObject"></param> |
389 | /// <param name="attachToBackup"> | 393 | /// <param name="attachToBackup"> |
390 | /// If true, the object is made persistent into the scene. | 394 | /// If true, the object is made persistent into the scene. |
@@ -1048,6 +1052,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
1048 | } | 1052 | } |
1049 | 1053 | ||
1050 | /// <summary> | 1054 | /// <summary> |
1055 | /// Get a group in the scene | ||
1056 | /// </summary> | ||
1057 | /// <param name="fullID">UUID of the group</param> | ||
1058 | /// <returns>null if no such group was found</returns> | ||
1059 | protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID) | ||
1060 | { | ||
1061 | lock (SceneObjectGroupsByFullID) | ||
1062 | { | ||
1063 | if (SceneObjectGroupsByFullID.ContainsKey(fullID)) | ||
1064 | return SceneObjectGroupsByFullID[fullID]; | ||
1065 | } | ||
1066 | |||
1067 | return null; | ||
1068 | } | ||
1069 | |||
1070 | /// <summary> | ||
1071 | /// Get a group by name from the scene (will return the first | ||
1072 | /// found, if there are more than one prim with the same name) | ||
1073 | /// </summary> | ||
1074 | /// <param name="name"></param> | ||
1075 | /// <returns>null if the part was not found</returns> | ||
1076 | protected internal SceneObjectGroup GetSceneObjectGroup(string name) | ||
1077 | { | ||
1078 | SceneObjectGroup so = null; | ||
1079 | |||
1080 | Entities.Find( | ||
1081 | delegate(EntityBase entity) | ||
1082 | { | ||
1083 | if (entity is SceneObjectGroup) | ||
1084 | { | ||
1085 | if (entity.Name == name) | ||
1086 | { | ||
1087 | so = (SceneObjectGroup)entity; | ||
1088 | return true; | ||
1089 | } | ||
1090 | } | ||
1091 | |||
1092 | return false; | ||
1093 | } | ||
1094 | ); | ||
1095 | |||
1096 | return so; | ||
1097 | } | ||
1098 | |||
1099 | /// <summary> | ||
1051 | /// Get a part contained in this scene. | 1100 | /// Get a part contained in this scene. |
1052 | /// </summary> | 1101 | /// </summary> |
1053 | /// <param name="localID"></param> | 1102 | /// <param name="localID"></param> |
@@ -1061,7 +1110,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1061 | } | 1110 | } |
1062 | 1111 | ||
1063 | /// <summary> | 1112 | /// <summary> |
1064 | /// Get a named prim contained in this scene (will return the first | 1113 | /// Get a prim by name from the scene (will return the first |
1065 | /// found, if there are more than one prim with the same name) | 1114 | /// found, if there are more than one prim with the same name) |
1066 | /// </summary> | 1115 | /// </summary> |
1067 | /// <param name="name"></param> | 1116 | /// <param name="name"></param> |