diff options
author | UbitUmarov | 2014-10-26 01:27:43 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-26 01:27:43 +0100 |
commit | 639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e (patch) | |
tree | e0d2036db16114a1cc2f6a0709534c31f87f6c82 | |
parent | some code reorder/minor changes (diff) | |
download | opensim-SC-639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e.zip opensim-SC-639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e.tar.gz opensim-SC-639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e.tar.bz2 opensim-SC-639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e.tar.xz |
some cleanup, localID coerence fix..
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 |
2 files changed, 10 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a1cdfa5..dea8f3e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2274,28 +2274,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2274 | 2274 | ||
2275 | // new group as no sitting avatars | 2275 | // new group as no sitting avatars |
2276 | dupe.m_linkedAvatars = new List<ScenePresence>(); | 2276 | dupe.m_linkedAvatars = new List<ScenePresence>(); |
2277 | |||
2278 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | ||
2279 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | ||
2280 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | ||
2281 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | ||
2282 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | ||
2283 | // then restore it's attachment state | ||
2284 | |||
2285 | // This is only necessary when userExposed is false! | ||
2286 | |||
2287 | bool previousAttachmentStatus = dupe.IsAttachment; | ||
2288 | |||
2289 | if (!userExposed) | ||
2290 | dupe.IsAttachment = true; | ||
2291 | |||
2292 | dupe.m_sittingAvatars = new List<UUID>(); | 2277 | dupe.m_sittingAvatars = new List<UUID>(); |
2293 | 2278 | ||
2294 | if (!userExposed) | ||
2295 | { | ||
2296 | dupe.IsAttachment = previousAttachmentStatus; | ||
2297 | } | ||
2298 | |||
2299 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 2279 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
2300 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 2280 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
2301 | 2281 | ||
@@ -2318,7 +2298,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2318 | { | 2298 | { |
2319 | newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | 2299 | newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); |
2320 | newPart.LinkNum = part.LinkNum; | 2300 | newPart.LinkNum = part.LinkNum; |
2321 | if (userExposed) | 2301 | // if (userExposed) |
2322 | newPart.ParentID = dupe.m_rootPart.LocalId; | 2302 | newPart.ParentID = dupe.m_rootPart.LocalId; |
2323 | } | 2303 | } |
2324 | else | 2304 | else |
@@ -2379,10 +2359,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2379 | /// <param name="cGroupID"></param> | 2359 | /// <param name="cGroupID"></param> |
2380 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 2360 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
2381 | { | 2361 | { |
2382 | // SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); | 2362 | SceneObjectPart newpart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed); |
2383 | // give newpart a new local ID lettng old part keep same | 2363 | // SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed); |
2384 | SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed); | 2364 | // newpart.LocalId = m_scene.AllocateLocalId(); |
2385 | newpart.LocalId = m_scene.AllocateLocalId(); | ||
2386 | 2365 | ||
2387 | SetRootPart(newpart); | 2366 | SetRootPart(newpart); |
2388 | if (userExposed) | 2367 | if (userExposed) |
@@ -2601,8 +2580,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2601 | /// <param name="cGroupID"></param> | 2580 | /// <param name="cGroupID"></param> |
2602 | public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 2581 | public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
2603 | { | 2582 | { |
2604 | SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed); | 2583 | SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); |
2605 | newPart.LocalId = m_scene.AllocateLocalId(); | 2584 | // SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed); |
2585 | // newPart.LocalId = m_scene.AllocateLocalId(); | ||
2606 | 2586 | ||
2607 | AddPart(newPart); | 2587 | AddPart(newPart); |
2608 | 2588 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d5377d0..91293c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2132 | /// <param name="linkNum"></param> | 2132 | /// <param name="linkNum"></param> |
2133 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | 2133 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> |
2134 | /// <returns></returns> | 2134 | /// <returns></returns> |
2135 | public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) | 2135 | public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) |
2136 | { | 2136 | { |
2137 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); | 2137 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); |
2138 | dupe.m_shape = m_shape.Copy(); | 2138 | dupe.m_shape = m_shape.Copy(); |
@@ -2178,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2178 | } | 2178 | } |
2179 | 2179 | ||
2180 | // Move afterwards ResetIDs as it clears the localID | 2180 | // Move afterwards ResetIDs as it clears the localID |
2181 | dupe.LocalId = localID; | 2181 | dupe.LocalId = plocalID; |
2182 | 2182 | ||
2183 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 2183 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
2184 | dupe.LastOwnerID = OwnerID; | 2184 | dupe.LastOwnerID = OwnerID; |
@@ -2208,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | if (dupe.PhysActor != null) | 2210 | if (dupe.PhysActor != null) |
2211 | dupe.PhysActor.LocalID = localID; | 2211 | dupe.PhysActor.LocalID = plocalID; |
2212 | 2212 | ||
2213 | ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); | 2213 | ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); |
2214 | 2214 | ||