diff options
author | Melanie | 2011-11-02 23:42:09 +0100 |
---|---|---|
committer | Melanie | 2011-11-02 23:42:09 +0100 |
commit | ce8419fdd0d3384a9df037d9df1b5d7d8960d1d8 (patch) | |
tree | d65a58057830c8eb61596925f4cc6066ff34940e | |
parent | Merge branch 'master' into bigmerge (diff) | |
download | opensim-SC-ce8419fdd0d3384a9df037d9df1b5d7d8960d1d8.zip opensim-SC-ce8419fdd0d3384a9df037d9df1b5d7d8960d1d8.tar.gz opensim-SC-ce8419fdd0d3384a9df037d9df1b5d7d8960d1d8.tar.bz2 opensim-SC-ce8419fdd0d3384a9df037d9df1b5d7d8960d1d8.tar.xz |
Fix link order when linking sets to sets
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 50 |
2 files changed, 18 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a6178e7..0f5e99d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1752,7 +1752,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1752 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1752 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1753 | 1753 | ||
1754 | // We do this in reverse to get the link order of the prims correct | 1754 | // We do this in reverse to get the link order of the prims correct |
1755 | for (int i = children.Count - 1; i >= 0; i--) | 1755 | for (int i = 0 ; i < children.Count ; i++) |
1756 | { | 1756 | { |
1757 | SceneObjectGroup child = children[i].ParentGroup; | 1757 | SceneObjectGroup child = children[i].ParentGroup; |
1758 | 1758 | ||
@@ -1784,6 +1784,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1784 | } | 1784 | } |
1785 | finally | 1785 | finally |
1786 | { | 1786 | { |
1787 | lock (SceneObjectGroupsByLocalPartID) | ||
1788 | { | ||
1789 | foreach (SceneObjectPart part in parentGroup.Parts) | ||
1790 | SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup; | ||
1791 | } | ||
1792 | |||
1787 | parentGroup.areUpdatesSuspended = false; | 1793 | parentGroup.areUpdatesSuspended = false; |
1788 | parentGroup.HasGroupChanged = true; | 1794 | parentGroup.HasGroupChanged = true; |
1789 | parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); | 1795 | parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8b71f5b..3a863e7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2351,16 +2351,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2351 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> | 2351 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
2352 | public void LinkToGroup(SceneObjectGroup objectGroup) | 2352 | public void LinkToGroup(SceneObjectGroup objectGroup) |
2353 | { | 2353 | { |
2354 | // Make sure we have sent any pending unlinks or stuff. | ||
2355 | //if (objectGroup.RootPart.UpdateFlag > 0) | ||
2356 | //{ | ||
2357 | // m_log.WarnFormat( | ||
2358 | // "[SCENE OBJECT GROUP]: Forcing send of linkset {0}, {1} to {2}, {3} as its still waiting.", | ||
2359 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); | ||
2360 | |||
2361 | // objectGroup.RootPart.SendScheduledUpdates(); | ||
2362 | //} | ||
2363 | |||
2364 | // m_log.DebugFormat( | 2354 | // m_log.DebugFormat( |
2365 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", | 2355 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", |
2366 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); | 2356 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); |
@@ -2384,45 +2374,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2384 | linkPart.RotationOffset = newRot; | 2374 | linkPart.RotationOffset = newRot; |
2385 | 2375 | ||
2386 | linkPart.ParentID = m_rootPart.LocalId; | 2376 | linkPart.ParentID = m_rootPart.LocalId; |
2377 | |||
2387 | if (m_rootPart.LinkNum == 0) | 2378 | if (m_rootPart.LinkNum == 0) |
2388 | m_rootPart.LinkNum = 1; | 2379 | m_rootPart.LinkNum = 1; |
2389 | 2380 | ||
2390 | lock (m_parts.SyncRoot) | 2381 | lock (m_parts.SyncRoot) |
2391 | { | 2382 | { |
2392 | m_parts.Add(linkPart.UUID, linkPart); | 2383 | int linkNum = PrimCount + 1; |
2393 | |||
2394 | // Insert in terms of link numbers, the new links | ||
2395 | // before the current ones (with the exception of | ||
2396 | // the root prim. Shuffle the old ones up | ||
2397 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
2398 | for (int i = 0; i < parts.Length; i++) | ||
2399 | { | ||
2400 | SceneObjectPart part = parts[i]; | ||
2401 | if (part.LinkNum != 1) | ||
2402 | { | ||
2403 | // Don't update root prim link number | ||
2404 | part.LinkNum += objectGroup.PrimCount; | ||
2405 | } | ||
2406 | } | ||
2407 | } | ||
2408 | 2384 | ||
2409 | linkPart.LinkNum = 2; | 2385 | m_parts.Add(linkPart.UUID, linkPart); |
2410 | 2386 | ||
2411 | linkPart.SetParent(this); | 2387 | linkPart.SetParent(this); |
2412 | linkPart.CreateSelected = true; | 2388 | linkPart.CreateSelected = true; |
2413 | 2389 | ||
2414 | lock (m_parts.SyncRoot) | 2390 | linkPart.LinkNum = linkNum++; |
2415 | { | ||
2416 | //if (linkPart.PhysActor != null) | ||
2417 | //{ | ||
2418 | // m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); | ||
2419 | 2391 | ||
2420 | //linkPart.PhysActor = null; | ||
2421 | //} | ||
2422 | |||
2423 | //TODO: rest of parts | ||
2424 | int linkNum = 3; | ||
2425 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2392 | SceneObjectPart[] ogParts = objectGroup.Parts; |
2393 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) | ||
2394 | { | ||
2395 | return a.LinkNum - b.LinkNum; | ||
2396 | }); | ||
2397 | |||
2426 | for (int i = 0; i < ogParts.Length; i++) | 2398 | for (int i = 0; i < ogParts.Length; i++) |
2427 | { | 2399 | { |
2428 | SceneObjectPart part = ogParts[i]; | 2400 | SceneObjectPart part = ogParts[i]; |