diff options
author | Sean Dague | 2007-11-13 19:57:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-11-13 19:57:11 +0000 |
commit | eb41ec00c94170305fd764d5e0ad5bee04018551 (patch) | |
tree | a46c4acb189887b44f63f4e2bd0d6c808b58f0be /OpenSim/Region/Environment/Scenes/InnerScene.cs | |
parent | Added "remove-region <region name>" console command that "should" remove the ... (diff) | |
download | opensim-SC-eb41ec00c94170305fd764d5e0ad5bee04018551.zip opensim-SC-eb41ec00c94170305fd764d5e0ad5bee04018551.tar.gz opensim-SC-eb41ec00c94170305fd764d5e0ad5bee04018551.tar.bz2 opensim-SC-eb41ec00c94170305fd764d5e0ad5bee04018551.tar.xz |
first pass on unlinking of objects. From Jay Clarke (IBM)
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 | /// |