aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs51
1 files changed, 43 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ee097bc..a3c5a03 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1891,9 +1891,31 @@ namespace OpenSim.Region.Framework.Scenes
1891 /// true if the object was added, false if an object with the same uuid was already in the scene 1891 /// true if the object was added, false if an object with the same uuid was already in the scene
1892 /// </returns> 1892 /// </returns>
1893 public bool AddRestoredSceneObject( 1893 public bool AddRestoredSceneObject(
1894 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
1895 {
1896 return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
1897 }
1898
1899 /// <summary>
1900 /// Add an object into the scene that has come from storage
1901 /// </summary>
1902 ///
1903 /// <param name="sceneObject"></param>
1904 /// <param name="attachToBackup">
1905 /// If true, changes to the object will be reflected in its persisted data
1906 /// If false, the persisted data will not be changed even if the object in the scene is changed
1907 /// </param>
1908 /// <param name="alreadyPersisted">
1909 /// If true, we won't persist this object until it changes
1910 /// If false, we'll persist this object immediately
1911 /// </param>
1912 /// <returns>
1913 /// true if the object was added, false if an object with the same uuid was already in the scene
1914 /// </returns>
1915 public bool AddRestoredSceneObject(
1894 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) 1916 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
1895 { 1917 {
1896 return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); 1918 return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
1897 } 1919 }
1898 1920
1899 /// <summary> 1921 /// <summary>
@@ -1927,7 +1949,7 @@ namespace OpenSim.Region.Framework.Scenes
1927 } 1949 }
1928 1950
1929 /// <summary> 1951 /// <summary>
1930 /// Delete every object from the scene 1952 /// Delete every object from the scene. This does not include attachments worn by avatars.
1931 /// </summary> 1953 /// </summary>
1932 public void DeleteAllSceneObjects() 1954 public void DeleteAllSceneObjects()
1933 { 1955 {
@@ -1938,7 +1960,11 @@ namespace OpenSim.Region.Framework.Scenes
1938 foreach (EntityBase e in entities) 1960 foreach (EntityBase e in entities)
1939 { 1961 {
1940 if (e is SceneObjectGroup) 1962 if (e is SceneObjectGroup)
1941 DeleteSceneObject((SceneObjectGroup)e, false); 1963 {
1964 SceneObjectGroup sog = (SceneObjectGroup)e;
1965 if (!sog.IsAttachment)
1966 DeleteSceneObject((SceneObjectGroup)e, false);
1967 }
1942 } 1968 }
1943 } 1969 }
1944 } 1970 }
@@ -2502,7 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes
2502 /// <returns></returns> 2528 /// <returns></returns>
2503 public bool IncomingCreateObject(ISceneObject sog) 2529 public bool IncomingCreateObject(ISceneObject sog)
2504 { 2530 {
2505 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2531 m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
2506 SceneObjectGroup newObject; 2532 SceneObjectGroup newObject;
2507 try 2533 try
2508 { 2534 {
@@ -2574,10 +2600,12 @@ namespace OpenSim.Region.Framework.Scenes
2574 2600
2575 if (sceneObject.IsAttachmentCheckFull()) // Attachment 2601 if (sceneObject.IsAttachmentCheckFull()) // Attachment
2576 { 2602 {
2603 m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId);
2604
2577 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); 2605 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
2578 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 2606 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
2579 2607
2580 AddRestoredSceneObject(sceneObject, false, false); 2608 AddRestoredSceneObject(sceneObject, false, false, false);
2581 2609
2582 // Handle attachment special case 2610 // Handle attachment special case
2583 SceneObjectPart RootPrim = sceneObject.RootPart; 2611 SceneObjectPart RootPrim = sceneObject.RootPart;
@@ -2585,6 +2613,8 @@ namespace OpenSim.Region.Framework.Scenes
2585 // Fix up attachment Parent Local ID 2613 // Fix up attachment Parent Local ID
2586 ScenePresence sp = GetScenePresence(sceneObject.OwnerID); 2614 ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
2587 2615
2616 Console.WriteLine("AAAA");
2617
2588 //uint parentLocalID = 0; 2618 //uint parentLocalID = 0;
2589 if (sp != null) 2619 if (sp != null)
2590 { 2620 {
@@ -2603,20 +2633,25 @@ namespace OpenSim.Region.Framework.Scenes
2603 //grp.SetFromAssetID(grp.RootPart.LastOwnerID); 2633 //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
2604 m_log.DebugFormat( 2634 m_log.DebugFormat(
2605 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2635 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2606 2636
2637 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2607 AttachObject( 2638 AttachObject(
2608 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); 2639 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2609 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2640
2610 grp.SendGroupFullUpdate(); 2641 //grp.SendGroupFullUpdate();
2611 } 2642 }
2612 else 2643 else
2613 { 2644 {
2614 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2645 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2615 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2646 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2616 } 2647 }
2648
2649 Console.WriteLine("BBBB");
2617 } 2650 }
2618 else 2651 else
2619 { 2652 {
2653 m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
2654
2620 AddRestoredSceneObject(sceneObject, true, false); 2655 AddRestoredSceneObject(sceneObject, true, false);
2621 2656
2622 if (!Permissions.CanObjectEntry(sceneObject.UUID, 2657 if (!Permissions.CanObjectEntry(sceneObject.UUID,