diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
15 files changed, 129 insertions, 80 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7b88f4f..3c47873 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2095,19 +2095,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); | 2095 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); |
2096 | } | 2096 | } |
2097 | 2097 | ||
2098 | AddNewSceneObject(group, true); | 2098 | AddNewSceneObject(group, true, pos, rot, vel); |
2099 | |||
2100 | group.AbsolutePosition = pos; | ||
2101 | group.Velocity = vel; | ||
2102 | |||
2103 | if (rot != null) | ||
2104 | group.UpdateGroupRotationR((Quaternion)rot); | ||
2105 | |||
2106 | // TODO: This needs to be refactored with the similar code in | ||
2107 | // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | ||
2108 | // possibly by allowing this method to take a null rotation. | ||
2109 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | ||
2110 | group.RootPart.ApplyImpulse((vel * group.GetMass()), false); | ||
2111 | 2099 | ||
2112 | // We can only call this after adding the scene object, since the scene object references the scene | 2100 | // We can only call this after adding the scene object, since the scene object references the scene |
2113 | // to find out if scripts should be activated at all. | 2101 | // to find out if scripts should be activated at all. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9df7340..b9690fe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1971,16 +1971,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | /// <summary> | 1971 | /// <summary> |
1972 | /// Add a newly created object to the scene. | 1972 | /// Add a newly created object to the scene. |
1973 | /// </summary> | 1973 | /// </summary> |
1974 | /// | 1974 | /// <remarks> |
1975 | /// This method does not send updates to the client - callers need to handle this themselves. | 1975 | /// This method does not send updates to the client - callers need to handle this themselves. |
1976 | /// </remarks> | ||
1976 | /// <param name="sceneObject"></param> | 1977 | /// <param name="sceneObject"></param> |
1977 | /// <param name="attachToBackup"></param> | 1978 | /// <param name="attachToBackup"></param> |
1978 | /// <param name="pos">Position of the object</param> | 1979 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
1979 | /// <param name="rot">Rotation of the object</param> | 1980 | /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param> |
1980 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 1981 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
1981 | /// <returns></returns> | 1982 | /// <returns></returns> |
1982 | public bool AddNewSceneObject( | 1983 | public bool AddNewSceneObject( |
1983 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 1984 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
1984 | { | 1985 | { |
1985 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 1986 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
1986 | { | 1987 | { |
@@ -4278,7 +4279,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4278 | // } | 4279 | // } |
4279 | 4280 | ||
4280 | /// <summary> | 4281 | /// <summary> |
4281 | /// Get a named prim contained in this scene (will return the first | 4282 | /// Get a group via its UUID |
4283 | /// </summary> | ||
4284 | /// <param name="fullID"></param> | ||
4285 | /// <returns>null if no group with that name exists</returns> | ||
4286 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) | ||
4287 | { | ||
4288 | return m_sceneGraph.GetSceneObjectGroup(fullID); | ||
4289 | } | ||
4290 | |||
4291 | /// <summary> | ||
4292 | /// Get a group by name from the scene (will return the first | ||
4293 | /// found, if there are more than one prim with the same name) | ||
4294 | /// </summary> | ||
4295 | /// <param name="name"></param> | ||
4296 | /// <returns>null if no group with that name exists</returns> | ||
4297 | public SceneObjectGroup GetSceneObjectGroup(string name) | ||
4298 | { | ||
4299 | return m_sceneGraph.GetSceneObjectGroup(name); | ||
4300 | } | ||
4301 | |||
4302 | /// <summary> | ||
4303 | /// Get a prim by name from the scene (will return the first | ||
4282 | /// found, if there are more than one prim with the same name) | 4304 | /// found, if there are more than one prim with the same name) |
4283 | /// </summary> | 4305 | /// </summary> |
4284 | /// <param name="name"></param> | 4306 | /// <param name="name"></param> |
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> |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 855b589..cff649b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 45 | using OpenSim.Tests.Common.Mock; |
46 | using OpenSim.Tests.Common.Setup; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 667b74e..f69a4b4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Setup; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index ca635d7..895f2bb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework.Communications; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
37 | using OpenSim.Tests.Common.Setup; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index a6a95ef..0a82c4f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework.Communications; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
37 | using OpenSim.Tests.Common.Setup; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 0d26026..5357a06 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Region.CoreModules.World.Permissions; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Tests.Common.Setup; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index bdfcd1d..cb1d531 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework.Communications; | |||
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | using OpenSim.Tests.Common.Setup; | ||
39 | using log4net; | 38 | using log4net; |
40 | 39 | ||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 8876a43..77bd4c2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes; | |||
40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; | 40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; |
41 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | 42 | using OpenSim.Tests.Common.Mock; |
43 | using OpenSim.Tests.Common.Setup; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.Framework.Scenes.Tests | 44 | namespace OpenSim.Region.Framework.Scenes.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index efb757f..03ac252 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | ||
48 | 47 | ||
49 | namespace OpenSim.Region.Framework.Scenes.Tests | 48 | namespace OpenSim.Region.Framework.Scenes.Tests |
50 | { | 49 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index abcce66..13d93f9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 45 | using OpenSim.Tests.Common.Mock; |
46 | using OpenSim.Tests.Common.Setup; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index dd28416..1b5a54e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -36,7 +36,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
39 | using OpenSim.Tests.Common.Setup; | ||
40 | using System.Threading; | 39 | using System.Threading; |
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 2aef4b0..f4e14d4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -46,55 +46,55 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | |||
46 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | 48 | using OpenSim.Tests.Common.Mock; |
49 | using OpenSim.Tests.Common.Setup; | ||
50 | 49 | ||
51 | namespace OpenSim.Region.Framework.Tests | 50 | namespace OpenSim.Region.Framework.Tests |
52 | { | 51 | { |
53 | [TestFixture] | 52 | [TestFixture] |
54 | public class TaskInventoryTests | 53 | public class TaskInventoryTests |
55 | { | 54 | { |
56 | protected UserAccount CreateUser(Scene scene) | 55 | [Test] |
57 | { | 56 | public void TestRezObjectFromInventoryItem() |
58 | string userFirstName = "Jock"; | ||
59 | string userLastName = "Stirrup"; | ||
60 | string userPassword = "troll"; | ||
61 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
62 | return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); | ||
63 | } | ||
64 | |||
65 | protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) | ||
66 | { | ||
67 | string part1Name = "part1"; | ||
68 | UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000"); | ||
69 | SceneObjectPart part1 | ||
70 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
71 | { Name = part1Name, UUID = part1Id }; | ||
72 | return new SceneObjectGroup(part1); | ||
73 | } | ||
74 | |||
75 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) | ||
76 | { | 57 | { |
77 | AssetNotecard nc = new AssetNotecard(); | 58 | TestHelper.InMethod(); |
78 | nc.BodyText = "Hello World!"; | 59 | // log4net.Config.XmlConfigurator.Configure(); |
79 | nc.Encode(); | ||
80 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
81 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
82 | AssetBase ncAsset | ||
83 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
84 | scene.AssetService.Store(ncAsset); | ||
85 | TaskInventoryItem ncItem | ||
86 | = new TaskInventoryItem | ||
87 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | ||
88 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | ||
89 | part.Inventory.AddInventoryItem(ncItem, true); | ||
90 | 60 | ||
91 | return ncItem; | 61 | Scene scene = SceneSetupHelpers.SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | ||
63 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | ||
64 | SceneObjectPart sop1 = sog1.RootPart; | ||
65 | |||
66 | // Create an object embedded inside the first | ||
67 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | ||
68 | TaskInventoryItem taskSceneObjectItem | ||
69 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId); | ||
70 | |||
71 | scene.AddSceneObject(sog1); | ||
72 | |||
73 | Vector3 rezPos = new Vector3(10, 10, 10); | ||
74 | Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f); | ||
75 | Vector3 rezVel = new Vector3(2, 2, 2); | ||
76 | |||
77 | scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0); | ||
78 | |||
79 | SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso"); | ||
80 | |||
81 | Assert.That(rezzedObject, Is.Not.Null); | ||
82 | Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos)); | ||
83 | |||
84 | // Velocity doesn't get applied, probably because there is no physics in tests (yet) | ||
85 | // Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel)); | ||
86 | Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero)); | ||
87 | |||
88 | // Confusingly, this isn't the rezzedObject.Rotation | ||
89 | Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot)); | ||
92 | } | 90 | } |
93 | 91 | ||
94 | /// <summary> | 92 | /// <summary> |
95 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. | 93 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. |
96 | /// </summary> | 94 | /// </summary> |
95 | /// <remarks> | ||
97 | /// This should place it in the most suitable user folder. | 96 | /// This should place it in the most suitable user folder. |
97 | /// </remarks> | ||
98 | [Test] | 98 | [Test] |
99 | public void TestMoveTaskInventoryItem() | 99 | public void TestMoveTaskInventoryItem() |
100 | { | 100 | { |
@@ -102,10 +102,11 @@ namespace OpenSim.Region.Framework.Tests | |||
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 103 | ||
104 | Scene scene = SceneSetupHelpers.SetupScene(); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
105 | UserAccount user1 = CreateUser(scene); | 105 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 106 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
107 | SceneObjectPart sop1 = sog1.RootPart; | 107 | SceneObjectPart sop1 = sog1.RootPart; |
108 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 108 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
109 | |||
109 | InventoryFolderBase folder | 110 | InventoryFolderBase folder |
110 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 111 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
111 | 112 | ||
@@ -128,10 +129,10 @@ namespace OpenSim.Region.Framework.Tests | |||
128 | // log4net.Config.XmlConfigurator.Configure(); | 129 | // log4net.Config.XmlConfigurator.Configure(); |
129 | 130 | ||
130 | Scene scene = SceneSetupHelpers.SetupScene(); | 131 | Scene scene = SceneSetupHelpers.SetupScene(); |
131 | UserAccount user1 = CreateUser(scene); | 132 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 133 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
133 | SceneObjectPart sop1 = sog1.RootPart; | 134 | SceneObjectPart sop1 = sog1.RootPart; |
134 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 135 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
135 | 136 | ||
136 | // Perform test | 137 | // Perform test |
137 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 138 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index dbf9e0f..4da8df1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -33,7 +33,6 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Setup; | ||
37 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |