aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorTom2011-05-26 03:42:45 -0700
committerTom2011-05-26 03:42:45 -0700
commit03525959c96a76cf555923f9441407bddd538398 (patch)
tree2c293d455250908de315bd2de805e510538963d3 /OpenSim/Region/Framework/Scenes
parentSome additional protection, it seems that responsedata needs to be locked, bu... (diff)
parentAdd PayPrice to serialization format Xml2 (diff)
downloadopensim-SC_OLD-03525959c96a76cf555923f9441407bddd538398.zip
opensim-SC_OLD-03525959c96a76cf555923f9441407bddd538398.tar.gz
opensim-SC_OLD-03525959c96a76cf555923f9441407bddd538398.tar.bz2
opensim-SC_OLD-03525959c96a76cf555923f9441407bddd538398.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs45
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs67
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs85
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs1
19 files changed, 207 insertions, 85 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4ce7a6c..d326141 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -115,6 +115,10 @@ namespace OpenSim.Region.Framework.Scenes
115 115
116 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 116 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
117 117
118 public delegate void SceneShuttingDownDelegate(Scene scene);
119
120 public event SceneShuttingDownDelegate OnSceneShuttingDown;
121
118 /// <summary> 122 /// <summary>
119 /// Fired when an object is touched/grabbed. 123 /// Fired when an object is touched/grabbed.
120 /// </summary> 124 /// </summary>
@@ -2217,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes
2217 } 2221 }
2218 } 2222 }
2219 } 2223 }
2224
2225 public void TriggerSceneShuttingDown(Scene s)
2226 {
2227 SceneShuttingDownDelegate handler = OnSceneShuttingDown;
2228 if (handler != null)
2229 {
2230 foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
2231 {
2232 try
2233 {
2234 d(s);
2235 }
2236 catch (Exception e)
2237 {
2238 m_log.ErrorFormat(
2239 "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
2240 e.Message, e.StackTrace);
2241 }
2242 }
2243 }
2244 }
2220 } 2245 }
2221} 2246}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 17242dc..0b92818 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1423,7 +1423,10 @@ namespace OpenSim.Region.Framework.Scenes
1423 if (item.AssetType == (int)AssetType.Link) 1423 if (item.AssetType == (int)AssetType.Link)
1424 { 1424 {
1425 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); 1425 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
1426 linkedItemFolderIdsToSend.Add(linkedItem.Folder); 1426
1427 // Take care of genuinely broken links where the target doesn't exist
1428 if (linkedItem != null)
1429 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1427 } 1430 }
1428 } 1431 }
1429 1432
@@ -2142,19 +2145,7 @@ namespace OpenSim.Region.Framework.Scenes
2142 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2145 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2143 } 2146 }
2144 2147
2145 AddNewSceneObject(group, true); 2148 AddNewSceneObject(group, true, pos, rot, vel);
2146
2147 group.AbsolutePosition = pos;
2148 group.Velocity = vel;
2149
2150 if (rot != null)
2151 group.UpdateGroupRotationR((Quaternion)rot);
2152
2153 // TODO: This needs to be refactored with the similar code in
2154 // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2155 // possibly by allowing this method to take a null rotation.
2156 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2157 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2158 2149
2159 // We can only call this after adding the scene object, since the scene object references the scene 2150 // We can only call this after adding the scene object, since the scene object references the scene
2160 // to find out if scripts should be activated at all. 2151 // 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 bac66cb..254ad05 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -209,6 +209,7 @@ namespace OpenSim.Region.Framework.Scenes
209 209
210 private Timer m_mapGenerationTimer = new Timer(); 210 private Timer m_mapGenerationTimer = new Timer();
211 private bool m_generateMaptiles; 211 private bool m_generateMaptiles;
212 private bool m_useBackup = true;
212 213
213// private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>(); 214// private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>();
214 215
@@ -477,6 +478,11 @@ namespace OpenSim.Region.Framework.Scenes
477 get { return m_sceneGraph; } 478 get { return m_sceneGraph; }
478 } 479 }
479 480
481 public bool UseBackup
482 {
483 get { return m_useBackup; }
484 }
485
480 // an instance to the physics plugin's Scene object. 486 // an instance to the physics plugin's Scene object.
481 public PhysicsScene PhysicsScene 487 public PhysicsScene PhysicsScene
482 { 488 {
@@ -620,7 +626,7 @@ namespace OpenSim.Region.Framework.Scenes
620 "delete object uuid <UUID>", 626 "delete object uuid <UUID>",
621 "Delete object by uuid", HandleDeleteObject); 627 "Delete object by uuid", HandleDeleteObject);
622 MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", 628 MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
623 "delete object name <UUID>", 629 "delete object name <name>",
624 "Delete object by name", HandleDeleteObject); 630 "Delete object by name", HandleDeleteObject);
625 631
626 //Bind Storage Manager functions to some land manager functions for this scene 632 //Bind Storage Manager functions to some land manager functions for this scene
@@ -670,6 +676,9 @@ namespace OpenSim.Region.Framework.Scenes
670 IConfig startupConfig = m_config.Configs["Startup"]; 676 IConfig startupConfig = m_config.Configs["Startup"];
671 677
672 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 678 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
679 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
680 if (!m_useBackup)
681 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
673 682
674 //Animation states 683 //Animation states
675 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 684 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
@@ -1091,6 +1100,8 @@ namespace OpenSim.Region.Framework.Scenes
1091 shuttingdown = true; 1100 shuttingdown = true;
1092 1101
1093 m_log.Debug("[SCENE]: Persisting changed objects"); 1102 m_log.Debug("[SCENE]: Persisting changed objects");
1103 EventManager.TriggerSceneShuttingDown(this);
1104
1094 EntityBase[] entities = GetEntities(); 1105 EntityBase[] entities = GetEntities();
1095 foreach (EntityBase entity in entities) 1106 foreach (EntityBase entity in entities)
1096 { 1107 {
@@ -2014,16 +2025,17 @@ namespace OpenSim.Region.Framework.Scenes
2014 /// <summary> 2025 /// <summary>
2015 /// Add a newly created object to the scene. 2026 /// Add a newly created object to the scene.
2016 /// </summary> 2027 /// </summary>
2017 /// 2028 /// <remarks>
2018 /// This method does not send updates to the client - callers need to handle this themselves. 2029 /// This method does not send updates to the client - callers need to handle this themselves.
2030 /// </remarks>
2019 /// <param name="sceneObject"></param> 2031 /// <param name="sceneObject"></param>
2020 /// <param name="attachToBackup"></param> 2032 /// <param name="attachToBackup"></param>
2021 /// <param name="pos">Position of the object</param> 2033 /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
2022 /// <param name="rot">Rotation of the object</param> 2034 /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param>
2023 /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> 2035 /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
2024 /// <returns></returns> 2036 /// <returns></returns>
2025 public bool AddNewSceneObject( 2037 public bool AddNewSceneObject(
2026 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 2038 SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
2027 { 2039 {
2028 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) 2040 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
2029 { 2041 {
@@ -4436,7 +4448,28 @@ namespace OpenSim.Region.Framework.Scenes
4436 // } 4448 // }
4437 4449
4438 /// <summary> 4450 /// <summary>
4439 /// Get a named prim contained in this scene (will return the first 4451 /// Get a group via its UUID
4452 /// </summary>
4453 /// <param name="fullID"></param>
4454 /// <returns>null if no group with that name exists</returns>
4455 public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
4456 {
4457 return m_sceneGraph.GetSceneObjectGroup(fullID);
4458 }
4459
4460 /// <summary>
4461 /// Get a group by name from the scene (will return the first
4462 /// found, if there are more than one prim with the same name)
4463 /// </summary>
4464 /// <param name="name"></param>
4465 /// <returns>null if no group with that name exists</returns>
4466 public SceneObjectGroup GetSceneObjectGroup(string name)
4467 {
4468 return m_sceneGraph.GetSceneObjectGroup(name);
4469 }
4470
4471 /// <summary>
4472 /// Get a prim by name from the scene (will return the first
4440 /// found, if there are more than one prim with the same name) 4473 /// found, if there are more than one prim with the same name)
4441 /// </summary> 4474 /// </summary>
4442 /// <param name="name"></param> 4475 /// <param name="name"></param>
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>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b100b39..62277ff 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Framework.Scenes
1613 1613
1614 } 1614 }
1615 1615
1616 if (HasGroupChanged) 1616 if (m_scene.UseBackup && HasGroupChanged)
1617 { 1617 {
1618 // don't backup while it's selected or you're asking for changes mid stream. 1618 // don't backup while it's selected or you're asking for changes mid stream.
1619 if (isTimeToPersist() || forcedBackup) 1619 if (isTimeToPersist() || forcedBackup)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e7e3014..4e1d6b6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -145,7 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
145 145
146 public Vector3 StatusSandboxPos; 146 public Vector3 StatusSandboxPos;
147 147
148 // TODO: This needs to be persisted in next XML version update!
149 [XmlIgnore] 148 [XmlIgnore]
150 public int[] PayPrice = {-2,-2,-2,-2,-2}; 149 public int[] PayPrice = {-2,-2,-2,-2,-2};
151 150
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 769d8a5..c42302f 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -341,6 +341,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
341 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 341 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
342 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 342 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
343 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 343 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
344 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
345 m_SOPXmlProcessors.Add("PayPrice1", ProcessPayPrice1);
346 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
347 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
348 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
344 #endregion 349 #endregion
345 350
346 #region TaskInventoryXmlProcessors initialization 351 #region TaskInventoryXmlProcessors initialization
@@ -698,6 +703,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
698 { 703 {
699 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); 704 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
700 } 705 }
706
707 private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader)
708 {
709 obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
710 }
711
712 private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader)
713 {
714 obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
715 }
716
717 private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader)
718 {
719 obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
720 }
721
722 private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader)
723 {
724 obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
725 }
726
727 private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader)
728 {
729 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
730 }
731
701 #endregion 732 #endregion
702 733
703 #region TaskInventoryXmlProcessors 734 #region TaskInventoryXmlProcessors
@@ -1069,7 +1100,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1069 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); 1100 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
1070 } 1101 }
1071 1102
1072
1073 #endregion 1103 #endregion
1074 1104
1075 ////////// Write ///////// 1105 ////////// Write /////////
@@ -1175,6 +1205,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1175 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1205 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1176 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); 1206 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
1177 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); 1207 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
1208 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
1209 writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString());
1210 writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString());
1211 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1212 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1178 1213
1179 writer.WriteEndElement(); 1214 writer.WriteEndElement();
1180 } 1215 }
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;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 45using OpenSim.Tests.Common.Mock;
46using OpenSim.Tests.Common.Setup;
47 46
48namespace OpenSim.Region.Framework.Scenes.Tests 47namespace 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;
37using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Setup;
41 40
42namespace OpenSim.Region.Framework.Scenes.Tests 41namespace 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;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock; 36using OpenSim.Tests.Common.Mock;
37using OpenSim.Tests.Common.Setup;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace 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;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock; 36using OpenSim.Tests.Common.Mock;
37using OpenSim.Tests.Common.Setup;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace 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;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 39using OpenSim.Tests.Common.Mock;
40using OpenSim.Tests.Common.Setup;
41 40
42namespace OpenSim.Region.Framework.Scenes.Tests 41namespace 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;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock; 37using OpenSim.Tests.Common.Mock;
38using OpenSim.Tests.Common.Setup;
39using log4net; 38using log4net;
40 39
41namespace OpenSim.Region.Framework.Scenes.Tests 40namespace 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;
40using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 40using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock; 42using OpenSim.Tests.Common.Mock;
43using OpenSim.Tests.Common.Setup;
44 43
45namespace OpenSim.Region.Framework.Scenes.Tests 44namespace 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;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 46using OpenSim.Tests.Common.Mock;
47using OpenSim.Tests.Common.Setup;
48 47
49namespace OpenSim.Region.Framework.Scenes.Tests 48namespace 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;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 45using OpenSim.Tests.Common.Mock;
46using OpenSim.Tests.Common.Setup;
47 46
48namespace OpenSim.Region.Framework.Scenes.Tests 47namespace 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;
36using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 36using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
39using OpenSim.Tests.Common.Setup;
40using System.Threading; 39using System.Threading;
41 40
42namespace OpenSim.Region.Framework.Scenes.Tests 41namespace 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;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock; 48using OpenSim.Tests.Common.Mock;
49using OpenSim.Tests.Common.Setup;
50 49
51namespace OpenSim.Region.Framework.Tests 50namespace 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;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Setup;
37using OpenSim.Tests.Common.Mock; 36using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests