From b4a19a4fb42325da2dfabc1627a13e94be17891f Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 10 Feb 2008 18:56:34 +0000 Subject: * Added support for delinking individual prim from a linkset. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 30 +++++++++++++++++++--- .../Region/Environment/Scenes/SceneObjectGroup.cs | 7 +++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 19213fd..ca3b858 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -895,6 +895,7 @@ namespace OpenSim.Region.Environment.Scenes // be more efficient yet to keep this dictionary permanently on hand. Dictionary sceneObjects = new Dictionary(); + List EntitieList = GetEntities(); foreach (EntityBase ent in EntitieList) { @@ -902,14 +903,17 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup obj = (SceneObjectGroup) ent; sceneObjects.Add(obj.LocalId, obj); + } } // Find the root prim among the prim ids we've been given for (int i = 0; i < primIds.Count; i++) { + if (sceneObjects.ContainsKey(primIds[i])) { + parenPrim = sceneObjects[primIds[i]]; primIds.RemoveAt(i); break; @@ -925,9 +929,29 @@ namespace OpenSim.Region.Environment.Scenes } else { - m_log.InfoFormat("[SCENE]: " + - "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", - primIds); + // If the first scan failed, we need to do a /deep/ scan of the linkages. This is /really/ slow + // We know that this is not the root prim now essentially, so we don't have to worry about remapping + // which one is the root prim + bool delinkedSomething = false; + for (int i = 0; i < primIds.Count; i++) + { + foreach (SceneObjectGroup grp in sceneObjects.Values) + { + SceneObjectPart gPart = grp.GetChildPart(primIds[i]); + if (gPart != null) + { + grp.DelinkFromGroup(primIds[i]); + delinkedSomething = true; + } + + } + } + if (!delinkedSomething) + { + m_log.InfoFormat("[SCENE]: " + + "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", + primIds); + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a14d869..3cef65c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1218,6 +1218,13 @@ namespace OpenSim.Region.Environment.Scenes part.UpdateExtraParam(type, inUse, data); } } + public SceneObjectPart[] GetParts() + { + int numParts = Children.Count; + SceneObjectPart[] partArray = new SceneObjectPart[numParts]; + Children.Values.CopyTo(partArray, 0); + return partArray; + } public bool GetLocked() { return m_locked; -- cgit v1.1