diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 90478c6..c8e9b73 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -536,6 +536,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
536 | parenPrim.LinkToGroup(sceneObj); | 536 | parenPrim.LinkToGroup(sceneObj); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | |||
540 | /// <summary> | ||
541 | /// Delink a linkset | ||
542 | /// </summary> | ||
543 | /// <param name="prims"></param> | ||
544 | public void DelinkObjects(List<uint> primIds) | ||
545 | { | ||
546 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("DelinkObjects()"); | ||
547 | |||
548 | SceneObjectGroup parenPrim = null; | ||
549 | |||
550 | // Need a list of the SceneObjectGroup local ids | ||
551 | // XXX I'm anticipating that building this dictionary once is more efficient than | ||
552 | // repeated scanning of the Entity.Values for a large number of primIds. However, it might | ||
553 | // be more efficient yet to keep this dictionary permanently on hand. | ||
554 | Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); | ||
555 | foreach (EntityBase ent in Entities.Values) | ||
556 | { | ||
557 | if (ent is SceneObjectGroup) | ||
558 | { | ||
559 | SceneObjectGroup obj = (SceneObjectGroup)ent; | ||
560 | sceneObjects.Add(obj.LocalId, obj); | ||
561 | } | ||
562 | } | ||
563 | |||
564 | // Find the root prim among the prim ids we've been given | ||
565 | for (int i = 0; i < primIds.Count; i++) | ||
566 | { | ||
567 | if (sceneObjects.ContainsKey(primIds[i])) | ||
568 | { | ||
569 | parenPrim = sceneObjects[primIds[i]]; | ||
570 | primIds.RemoveAt(i); | ||
571 | break; | ||
572 | } | ||
573 | } | ||
574 | |||
575 | if (parenPrim != null) | ||
576 | { | ||
577 | foreach (uint childPrimId in primIds) | ||
578 | { | ||
579 | parenPrim.DelinkFromGroup(childPrimId); | ||
580 | } | ||
581 | } | ||
582 | else | ||
583 | { | ||
584 | OpenSim.Framework.Console.MainLog.Instance.Verbose( | ||
585 | "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", | ||
586 | primIds); | ||
587 | } | ||
588 | } | ||
539 | 589 | ||
540 | /// <summary> | 590 | /// <summary> |
541 | /// | 591 | /// |