aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-12 17:49:08 +0000
committerJustin Clarke Casey2008-06-12 17:49:08 +0000
commit8714833986cef44787fd57a61699b7bdcfd3d3bb (patch)
treefbd78ff5755484df5ca5732389a7006f92db6508 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parent* refactor: rename CreatePrimFromXml to CreatePrimFromXml2 (diff)
downloadopensim-SC-8714833986cef44787fd57a61699b7bdcfd3d3bb.zip
opensim-SC-8714833986cef44787fd57a61699b7bdcfd3d3bb.tar.gz
opensim-SC-8714833986cef44787fd57a61699b7bdcfd3d3bb.tar.bz2
opensim-SC-8714833986cef44787fd57a61699b7bdcfd3d3bb.tar.xz
* refactor: For new objects, move attach to backup to occur when adding to a scene, rather than on creation of the group
* Adding to a scene is now parameterized such that one can choose not to actually persist that group * This is to support a use case where a module wants a scene which consists of both objects which are persisted, and ones which are just temporary for the lifetime of that server instance
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs49
1 files changed, 10 insertions, 39 deletions
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 }