diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index ab0ec1f025..18fe151ef0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs @@ -1669,7 +1669,6 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID, true); copy.AbsolutePosition = copy.AbsolutePosition + offset; - copy.ResetIDs(); lock (Entities) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2d62d6606d..82ab4ebdf2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -591,17 +591,19 @@ namespace OpenSim.Region.Environment.Scenes { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; - + m_rootPart.ParentID = 0; - m_rootPart.LocalId = m_scene.AllocateLocalId(); + if (m_rootPart.LocalId==0) + m_rootPart.LocalId = m_scene.AllocateLocalId(); + // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_parts.Values) { if (Object.ReferenceEquals(part, m_rootPart)) continue; - - part.LocalId = m_scene.AllocateLocalId(); + if (part.LocalId==0) + part.LocalId = m_scene.AllocateLocalId(); part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index a626fa300d..96ee1691a0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1223,7 +1223,6 @@ if (m_shape != null) { if (userExposed) dupe.UUID = UUID.Random(); - dupe.LocalId = localID; dupe._ownerID = AgentID; dupe._groupID = GroupID; dupe.GroupPosition = GroupPosition; @@ -1245,6 +1244,8 @@ if (m_shape != null) { if (userExposed) dupe.ResetIDs(linkNum); + // Move afterwards ResetIDs as it clears the localID + dupe.LocalId = localID; // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe._lastOwnerID = ObjectOwner; @@ -1927,6 +1928,7 @@ if (m_shape != null) { { UUID = UUID.Random(); LinkNum = linkNum; + LocalId = 0; ResetInventoryIDs(); }