aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs49
6 files changed, 43 insertions, 55 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index 0c4887f..54538d8 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes 64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
65 //obj.RegenerateFullIDs(); 65 //obj.RegenerateFullIDs();
66 66
67 scene.AddSceneObject(obj); 67 scene.AddSceneObject(obj, true);
68 68
69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
70 // Apply loadOffsets for load/import and move combinations 70 // Apply loadOffsets for load/import and move combinations
@@ -193,8 +193,7 @@ namespace OpenSim.Region.Environment.Scenes
193 /// <param name="xmlData"></param> 193 /// <param name="xmlData"></param>
194 protected static void CreatePrimFromXml2(Scene scene, string xmlData) 194 protected static void CreatePrimFromXml2(Scene scene, string xmlData)
195 { 195 {
196 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 196 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
197
198 197
199 LLVector3 receivedVelocity = obj.RootPart.Velocity; 198 LLVector3 receivedVelocity = obj.RootPart.Velocity;
200 //System.Console.WriteLine(obj.RootPart.Velocity.ToString()); 199 //System.Console.WriteLine(obj.RootPart.Velocity.ToString());
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 3cd32c6..d09efd8 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -193,6 +193,7 @@ namespace OpenSim.Region.Environment.Scenes
193 { 193 {
194 sceneObject.RegionHandle = m_regInfo.RegionHandle; 194 sceneObject.RegionHandle = m_regInfo.RegionHandle;
195 sceneObject.SetScene(m_parentScene); 195 sceneObject.SetScene(m_parentScene);
196
196 foreach (SceneObjectPart part in sceneObject.Children.Values) 197 foreach (SceneObjectPart part in sceneObject.Children.Values)
197 { 198 {
198 part.LocalId = m_parentScene.PrimIDAllocate(); 199 part.LocalId = m_parentScene.PrimIDAllocate();
@@ -200,16 +201,20 @@ namespace OpenSim.Region.Environment.Scenes
200 } 201 }
201 sceneObject.UpdateParentIDs(); 202 sceneObject.UpdateParentIDs();
202 203
203 AddSceneObject(sceneObject); 204 AddSceneObject(sceneObject, true);
204 } 205 }
205 206
206 /// <summary> 207 /// <summary>
207 /// Add an object to the scene. 208 /// Add an object to the scene.
208 /// </summary> 209 /// </summary>
209 /// <param name="sceneObject"></param> 210 /// <param name="sceneObject"></param>
211 /// <param name="attachToBackup">
212 /// If true, the object is made persistent into the scene.
213 /// If false, the object will not persist over server restarts
214 /// </param>
210 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene 215 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene
211 /// </returns> 216 /// </returns>
212 protected internal bool AddSceneObject(SceneObjectGroup sceneObject) 217 protected internal bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
213 { 218 {
214 lock (Entities) 219 lock (Entities)
215 { 220 {
@@ -218,6 +223,9 @@ namespace OpenSim.Region.Environment.Scenes
218 // QuadTree.AddSceneObject(sceneObject); 223 // QuadTree.AddSceneObject(sceneObject);
219 Entities.Add(sceneObject.UUID, sceneObject); 224 Entities.Add(sceneObject.UUID, sceneObject);
220 m_numPrim += sceneObject.Children.Count; 225 m_numPrim += sceneObject.Children.Count;
226
227 if (attachToBackup)
228 sceneObject.AttachToBackup();
221 229
222 return true; 230 return true;
223 } 231 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ead7f23..ebc721f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1483,8 +1483,6 @@ namespace OpenSim.Region.Environment.Scenes
1483 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), 1483 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
1484 BypassRayCast, bRayEndIsIntersection,true,scale, false); 1484 BypassRayCast, bRayEndIsIntersection,true,scale, false);
1485 1485
1486
1487
1488 // Rez object 1486 // Rez object
1489 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 1487 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
1490 if (userInfo != null) 1488 if (userInfo != null)
@@ -1508,7 +1506,7 @@ namespace OpenSim.Region.Environment.Scenes
1508 1506
1509 group.ResetIDs(); 1507 group.ResetIDs();
1510 1508
1511 AddSceneObject(group); 1509 AddSceneObject(group, true);
1512 1510
1513 // if attachment we set it's asset id so object updates can reflect that 1511 // if attachment we set it's asset id so object updates can reflect that
1514 // if not, we set it's position in world. 1512 // if not, we set it's position in world.
@@ -1601,6 +1599,15 @@ namespace OpenSim.Region.Environment.Scenes
1601 return null; 1599 return null;
1602 } 1600 }
1603 1601
1602 /// <summary>
1603 /// Rez an object in the scene
1604 /// </summary>
1605 /// <param name="item"></param>
1606 /// <param name="pos"></param>
1607 /// <param name="rot"></param>
1608 /// <param name="vel"></param>
1609 /// <param name="param"></param>
1610 /// <returns></returns>
1604 public virtual SceneObjectGroup RezObject(TaskInventoryItem item, LLVector3 pos, LLQuaternion rot, LLVector3 vel, int param) 1611 public virtual SceneObjectGroup RezObject(TaskInventoryItem item, LLVector3 pos, LLQuaternion rot, LLVector3 vel, int param)
1605 { 1612 {
1606 // Rez object 1613 // Rez object
@@ -1621,7 +1628,7 @@ namespace OpenSim.Region.Environment.Scenes
1621 } 1628 }
1622 group.ResetIDs(); 1629 group.ResetIDs();
1623 1630
1624 AddSceneObject(group); 1631 AddSceneObject(group, true);
1625 1632
1626 // Set the startup parameter for on_rez event and llGetStartParameter() function 1633 // Set the startup parameter for on_rez event and llGetStartParameter() function
1627 group.StartParameter = param; 1634 group.StartParameter = param;
@@ -1678,10 +1685,11 @@ namespace OpenSim.Region.Environment.Scenes
1678 rootPart.ScheduleFullUpdate(); 1685 rootPart.ScheduleFullUpdate();
1679 return rootPart.ParentGroup; 1686 return rootPart.ParentGroup;
1680 } 1687 }
1681
1682 } 1688 }
1689
1683 return null; 1690 return null;
1684 } 1691 }
1692
1685 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, LLUUID AgentId) 1693 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, LLUUID AgentId)
1686 { 1694 {
1687 string message = ""; 1695 string message = "";
@@ -1699,9 +1707,6 @@ namespace OpenSim.Region.Environment.Scenes
1699 //} 1707 //}
1700 //returnstring += "</scene>\n"; 1708 //returnstring += "</scene>\n";
1701 1709
1702
1703
1704
1705 bool permissionToDelete = false; 1710 bool permissionToDelete = false;
1706 1711
1707 for (int i = 0; i < returnobjects.Length; i++) 1712 for (int i = 0; i < returnobjects.Length; i++)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 526c125..43bb709 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Environment.Scenes
1492 { 1492 {
1493 SceneObjectGroup sceneOb = 1493 SceneObjectGroup sceneOb =
1494 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); 1494 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
1495 AddSceneObject(sceneOb); 1495 AddSceneObject(sceneOb, true);
1496 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 1496 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
1497 // if grass or tree, make phantom 1497 // if grass or tree, make phantom
1498 //rootPart.TrimPermissions(); 1498 //rootPart.TrimPermissions();
@@ -1556,9 +1556,13 @@ namespace OpenSim.Region.Environment.Scenes
1556 /// Add an object to the scene 1556 /// Add an object to the scene
1557 /// </summary> 1557 /// </summary>
1558 /// <param name="sceneObject"></param> 1558 /// <param name="sceneObject"></param>
1559 public void AddSceneObject(SceneObjectGroup sceneObject) 1559 /// <param name="attachToBackup">
1560 /// If true, the object is made persistent into the scene.
1561 /// If false, the object will not persist over server restarts
1562 /// </param>
1563 public void AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
1560 { 1564 {
1561 m_innerScene.AddSceneObject(sceneObject); 1565 m_innerScene.AddSceneObject(sceneObject, attachToBackup);
1562 } 1566 }
1563 1567
1564 /// <summary> 1568 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 3e84af0..aea433e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -124,6 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
124 } 124 }
125 } 125 }
126 126
127 /// <summary>
127 /// Start a given script. 128 /// Start a given script.
128 /// </summary> 129 /// </summary>
129 /// <param name="localID"> 130 /// <param name="localID">
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 67e2c70..336009b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -351,15 +351,13 @@ namespace OpenSim.Region.Environment.Scenes
351 351
352 RegionHandle = regionHandle; 352 RegionHandle = regionHandle;
353 353
354 AttachToBackup();
355
356 ApplyPhysics(scene.m_physicalPrim); 354 ApplyPhysics(scene.m_physicalPrim);
357 355
358 ScheduleGroupForFullUpdate(); 356 ScheduleGroupForFullUpdate();
359 } 357 }
360 358
361 /// <summary> 359 /// <summary>
362 /// Restore the object from its serialized xml representation. 360 /// Create an object using serialized data in OpenSim's original xml format.
363 /// </summary> 361 /// </summary>
364 public SceneObjectGroup(Scene scene, ulong regionHandle, string xmlData) 362 public SceneObjectGroup(Scene scene, ulong regionHandle, string xmlData)
365 { 363 {
@@ -417,15 +415,13 @@ namespace OpenSim.Region.Environment.Scenes
417 m_rootPart.RegionHandle = m_regionHandle; 415 m_rootPart.RegionHandle = m_regionHandle;
418 UpdateParentIDs(); 416 UpdateParentIDs();
419 417
420 AttachToBackup();
421
422 ApplyPhysics(scene.m_physicalPrim); 418 ApplyPhysics(scene.m_physicalPrim);
423 419
424 ScheduleGroupForFullUpdate(); 420 ScheduleGroupForFullUpdate();
425 } 421 }
426 422
427 /// <summary> 423 /// <summary>
428 /// 424 /// Create an object using serialized data in OpenSim's xml2 format.
429 /// </summary> 425 /// </summary>
430 public SceneObjectGroup(string xmlData) 426 public SceneObjectGroup(string xmlData)
431 { 427 {
@@ -495,6 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
495 491
496 //ApplyPhysics(scene.m_physicalPrim); 492 //ApplyPhysics(scene.m_physicalPrim);
497 } 493 }
494
498 /// <summary> 495 /// <summary>
499 /// 496 ///
500 /// </summary> 497 /// </summary>
@@ -527,7 +524,7 @@ namespace OpenSim.Region.Environment.Scenes
527 /// <summary> 524 /// <summary>
528 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. 525 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
529 /// </summary> 526 /// </summary>
530 private void AttachToBackup() 527 public void AttachToBackup()
531 { 528 {
532 if (InSceneBackup) 529 if (InSceneBackup)
533 { 530 {
@@ -822,7 +819,6 @@ namespace OpenSim.Region.Environment.Scenes
822 public void SetScene(Scene scene) 819 public void SetScene(Scene scene)
823 { 820 {
824 m_scene = scene; 821 m_scene = scene;
825 AttachToBackup();
826 } 822 }
827 823
828 /// <summary> 824 /// <summary>
@@ -1848,38 +1844,9 @@ namespace OpenSim.Region.Environment.Scenes
1848 1844
1849 linkPart.RotationOffset = worldRot; 1845 linkPart.RotationOffset = worldRot;
1850 1846
1851 // This chunk is probably unnecesary now - delete later on
1852 /*
1853 Quaternion oldRot
1854 = new Quaternion(
1855 linkPart.RotationOffset.W,
1856 linkPart.RotationOffset.X,
1857 linkPart.RotationOffset.Y,
1858 linkPart.RotationOffset.Z);
1859 Quaternion newRot = parentRot*oldRot;
1860 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1861 */
1862
1863 // Add physics information back to delinked part if appropriate
1864 // XXX This is messy and should be refactorable with the similar section in
1865 // SceneObjectPart.UpdatePrimFlags()
1866 //if (m_rootPart.PhysActor != null)
1867 //{
1868 //linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1869 //linkPart.Name,
1870 //linkPart.Shape,
1871 //new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y,
1872 //linkPart.AbsolutePosition.Z),
1873 //new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z),
1874 //new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
1875 //linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
1876 //m_rootPart.PhysActor.IsPhysical);
1877 //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
1878 //}
1879
1880 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); 1847 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart);
1881 1848
1882 m_scene.AddSceneObject(objectGroup); 1849 m_scene.AddSceneObject(objectGroup, true);
1883 1850
1884 ScheduleGroupForFullUpdate(); 1851 ScheduleGroupForFullUpdate();
1885 } 1852 }
@@ -1891,7 +1858,11 @@ namespace OpenSim.Region.Environment.Scenes
1891 } 1858 }
1892 } 1859 }
1893 1860
1894 private void DetachFromBackup(SceneObjectGroup objectGroup) 1861 /// <summary>
1862 /// Stop this object from being persisted over server restarts.
1863 /// </summary>
1864 /// <param name="objectGroup"></param>
1865 public void DetachFromBackup(SceneObjectGroup objectGroup)
1895 { 1866 {
1896 m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; 1867 m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
1897 } 1868 }