aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs95
1 files changed, 50 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f8b4483..6dc331b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2237,71 +2237,76 @@ namespace OpenSim.Region.Framework.Scenes
2237 { 2237 {
2238 SceneObjectPart linkPart = GetChildPart(partID); 2238 SceneObjectPart linkPart = GetChildPart(partID);
2239 2239
2240 if (null != linkPart) 2240 if (linkPart != null)
2241 { 2241 {
2242 linkPart.ClearUndoState(); 2242 DelinkFromGroup(linkPart, sendEvents);
2243 }
2244 else
2245 {
2246 m_log.InfoFormat("[SCENE OBJECT GROUP]: " +
2247 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
2248 partID, LocalId, UUID);
2249 }
2250 }
2251
2252 public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
2253 {
2254 linkPart.ClearUndoState();
2243// m_log.DebugFormat( 2255// m_log.DebugFormat(
2244// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 2256// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
2245// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 2257// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
2246 2258
2247 Quaternion worldRot = linkPart.GetWorldRotation(); 2259 Quaternion worldRot = linkPart.GetWorldRotation();
2248 2260
2249 // Remove the part from this object 2261 // Remove the part from this object
2250 lock (m_parts) 2262 lock (m_parts)
2251 { 2263 {
2252 m_parts.Remove(linkPart.UUID); 2264 m_parts.Remove(linkPart.UUID);
2253 } 2265 }
2254 2266
2255 if (m_parts.Count == 1 && RootPart != null) //Single prim is left 2267 if (m_parts.Count == 1 && RootPart != null) //Single prim is left
2256 RootPart.LinkNum = 0; 2268 RootPart.LinkNum = 0;
2257 else 2269 else
2270 {
2271 foreach (SceneObjectPart p in m_parts.Values)
2258 { 2272 {
2259 foreach (SceneObjectPart p in m_parts.Values) 2273 if (p.LinkNum > linkPart.LinkNum)
2260 { 2274 p.LinkNum--;
2261 if (p.LinkNum > linkPart.LinkNum)
2262 p.LinkNum--;
2263 }
2264 } 2275 }
2276 }
2265 2277
2266 linkPart.ParentID = 0; 2278 linkPart.ParentID = 0;
2267 linkPart.LinkNum = 0; 2279 linkPart.LinkNum = 0;
2268 2280
2269 if (linkPart.PhysActor != null) 2281 if (linkPart.PhysActor != null)
2270 { 2282 {
2271 m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); 2283 m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
2272 } 2284 }
2273 2285
2274 // We need to reset the child part's position 2286 // We need to reset the child part's position
2275 // ready for life as a separate object after being a part of another object 2287 // ready for life as a separate object after being a part of another object
2276 Quaternion parentRot = m_rootPart.RotationOffset; 2288 Quaternion parentRot = m_rootPart.RotationOffset;
2277 2289
2278 Vector3 axPos = linkPart.OffsetPosition; 2290 Vector3 axPos = linkPart.OffsetPosition;
2279 2291
2280 axPos *= parentRot; 2292 axPos *= parentRot;
2281 linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z); 2293 linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z);
2282 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; 2294 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition;
2283 linkPart.OffsetPosition = new Vector3(0, 0, 0); 2295 linkPart.OffsetPosition = new Vector3(0, 0, 0);
2284 2296
2285 linkPart.RotationOffset = worldRot; 2297 linkPart.RotationOffset = worldRot;
2286 2298
2287 SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); 2299 SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart);
2288 2300
2289 m_scene.AddNewSceneObject(objectGroup, true); 2301 m_scene.AddNewSceneObject(objectGroup, true);
2290 2302
2291 if (sendEvents) 2303 if (sendEvents)
2292 linkPart.TriggerScriptChangedEvent(Changed.LINK); 2304 linkPart.TriggerScriptChangedEvent(Changed.LINK);
2293 2305
2294 linkPart.Rezzed = RootPart.Rezzed; 2306 linkPart.Rezzed = RootPart.Rezzed;
2295 2307
2296 HasGroupChanged = true; 2308 HasGroupChanged = true;
2297 ScheduleGroupForFullUpdate(); 2309 ScheduleGroupForFullUpdate();
2298 }
2299 else
2300 {
2301 m_log.InfoFormat("[SCENE OBJECT GROUP]: " +
2302 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
2303 partID, LocalId, UUID);
2304 }
2305 } 2310 }
2306 2311
2307 /// <summary> 2312 /// <summary>