diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs index 3a9df4acea..5c2fc1c1c2 100644 --- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs @@ -218,8 +218,9 @@ namespace OpenSim.Region.CoreModules.Communications.Local { if (s.RegionInfo.RegionHandle == regionHandle) { - //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); - return s.IncomingCreateObject(sog); + //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); + ISceneObject sogClone = sog.CloneForNewScene(); + return s.IncomingCreateObject(sogClone); } } return false; diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index b4f4814012..8a4bb090c7 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs @@ -223,8 +223,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST public bool SendCreateObject(ulong regionHandle, ISceneObject sog) { // Try local first - ISceneObject sogClone = sog.CloneForNewScene(); - if (m_localBackend.SendCreateObject(regionHandle, sogClone)) + if (m_localBackend.SendCreateObject(regionHandle, sog)) { //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); return true; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b2d77f5b8d..fd979a3aa4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2168,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes public bool IncomingCreateObject(ISceneObject sog) { - //Console.WriteLine(" >>> IncomingCreateObject <<<"); + //Console.WriteLine(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); SceneObjectGroup newObject; try { @@ -2201,7 +2201,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } - // Force allocation of new LocalId // foreach (SceneObjectPart p in sceneObject.Children.Values) @@ -2209,59 +2208,57 @@ namespace OpenSim.Region.Framework.Scenes if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) { - if (sceneObject.RootPart.Shape.State != 0) + if (sceneObject.RootPart.Shape.State != 0) // Attchment { + + sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); + + AddRestoredSceneObject(sceneObject, false, false); + + // Handle attachment special case + // + //SceneObjectPart RootPrim = GetSceneObjectPart(primID); + SceneObjectPart RootPrim = sceneObject.RootPart; + // Fix up attachment Parent Local ID // ScenePresence sp = GetScenePresence(sceneObject.OwnerID); uint parentLocalID = 0; if (sp != null) + { parentLocalID = sp.LocalId; - sceneObject.RootPart.IsAttachment = true; - sceneObject.RootPart.SetParentLocalId(parentLocalID); + //sceneObject.RootPart.IsAttachment = true; + //sceneObject.RootPart.SetParentLocalId(parentLocalID); - AddRestoredSceneObject(sceneObject, false, false); + SceneObjectGroup grp = sceneObject; - // Handle attachment special case - // - SceneObjectPart RootPrim = GetSceneObjectPart(primID); - //SceneObjectPart RootPrim = sceneObject.RootPart; + //RootPrim.SetParentLocalId(parentLocalID); - if (RootPrim != null) - { - SceneObjectGroup grp = RootPrim.ParentGroup; - - RootPrim.SetParentLocalId(parentLocalID); - - if (grp != null) - { - m_log.DebugFormat("[ATTACHMENT]: Received " + + m_log.DebugFormat("[ATTACHMENT]: Received " + "attachment {0}, inworld asset id {1}", //grp.RootPart.LastOwnerID.ToString(), grp.GetFromAssetID(), grp.UUID.ToString()); - if (sp != null) - { - //grp.SetFromAssetID(grp.RootPart.LastOwnerID); - m_log.DebugFormat("[ATTACHMENT]: Attach " + - "to avatar {0}", - sp.UUID.ToString()); - AttachObject(sp.ControllingClient, - grp.LocalId, (uint)0, - grp.GroupRotation, - grp.AbsolutePosition, false); - grp.SendGroupFullUpdate(); - } - else - { - RootPrim.RemFlag(PrimFlags.TemporaryOnRez); - RootPrim.AddFlag(PrimFlags.TemporaryOnRez); - } - } + //grp.SetFromAssetID(grp.RootPart.LastOwnerID); + m_log.DebugFormat("[ATTACHMENT]: Attach " + + "to avatar {0} at position {1}", + sp.UUID.ToString(), grp.AbsolutePosition); + AttachObject(sp.ControllingClient, + grp.LocalId, (uint)0, + grp.GroupRotation, + grp.AbsolutePosition, false); + RootPrim.RemFlag(PrimFlags.TemporaryOnRez); + grp.SendGroupFullUpdate(); } + else + { + RootPrim.RemFlag(PrimFlags.TemporaryOnRez); + RootPrim.AddFlag(PrimFlags.TemporaryOnRez); + } + } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index c3485aba18..e1362f9089 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes public string GetStateSnapshot() { - Console.WriteLine(" >>> GetStateSnapshot <<<"); + //Console.WriteLine(" >>> GetStateSnapshot <<<"); List assemblies = new List(); Dictionary states = new Dictionary(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 520b228a3e..997cce538e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1717,6 +1717,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_rootPart == null) return; + if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) + return; + lock (m_parts) { bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); @@ -3036,6 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual ISceneObject CloneForNewScene() { SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); + sog.m_isDeleted = false; return sog; }