diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c9ea8e4..8809cd0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -957,12 +957,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
957 | /// <returns></returns> | 957 | /// <returns></returns> |
958 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 958 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
959 | { | 959 | { |
960 | maxX = -256f; | 960 | maxX = float.MinValue; |
961 | maxY = -256f; | 961 | maxY = float.MinValue; |
962 | maxZ = -256f; | 962 | maxZ = float.MinValue; |
963 | minX = 256f; | 963 | minX = float.MaxValue; |
964 | minY = 256f; | 964 | minY = float.MaxValue; |
965 | minZ = 8192f; | 965 | minZ = float.MaxValue; |
966 | 966 | ||
967 | SceneObjectPart[] parts = m_parts.GetArray(); | 967 | SceneObjectPart[] parts = m_parts.GetArray(); |
968 | foreach (SceneObjectPart part in parts) | 968 | foreach (SceneObjectPart part in parts) |
@@ -1988,7 +1988,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1988 | /// <param name="cGroupID"></param> | 1988 | /// <param name="cGroupID"></param> |
1989 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 1989 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
1990 | { | 1990 | { |
1991 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); | 1991 | // SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); |
1992 | // give newpart a new local ID lettng old part keep same | ||
1993 | SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed); | ||
1994 | newpart.LocalId = m_scene.AllocateLocalId(); | ||
1995 | |||
1996 | SetRootPart(newpart); | ||
1992 | if (userExposed) | 1997 | if (userExposed) |
1993 | RootPart.Velocity = Vector3.Zero; // In case source is moving | 1998 | RootPart.Velocity = Vector3.Zero; // In case source is moving |
1994 | } | 1999 | } |
@@ -2191,7 +2196,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2191 | /// <param name="cGroupID"></param> | 2196 | /// <param name="cGroupID"></param> |
2192 | public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 2197 | public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
2193 | { | 2198 | { |
2194 | SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); | 2199 | // give new ID to the new part, letting old keep original |
2200 | // SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); | ||
2201 | SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed); | ||
2202 | newPart.LocalId = m_scene.AllocateLocalId(); | ||
2195 | newPart.SetParent(this); | 2203 | newPart.SetParent(this); |
2196 | 2204 | ||
2197 | AddPart(newPart); | 2205 | AddPart(newPart); |
@@ -2485,6 +2493,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2485 | 2493 | ||
2486 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 2494 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
2487 | 2495 | ||
2496 | if (m_rootPart.PhysActor != null) | ||
2497 | m_rootPart.PhysActor.Building = true; | ||
2498 | if (linkPart.PhysActor != null) | ||
2499 | linkPart.PhysActor.Building = true; | ||
2500 | |||
2488 | Vector3 oldGroupPosition = linkPart.GroupPosition; | 2501 | Vector3 oldGroupPosition = linkPart.GroupPosition; |
2489 | Quaternion oldRootRotation = linkPart.RotationOffset; | 2502 | Quaternion oldRootRotation = linkPart.RotationOffset; |
2490 | 2503 | ||
@@ -2528,6 +2541,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2528 | linkPart.SetParent(this); | 2541 | linkPart.SetParent(this); |
2529 | linkPart.CreateSelected = true; | 2542 | linkPart.CreateSelected = true; |
2530 | 2543 | ||
2544 | // let physics know | ||
2545 | if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2546 | { | ||
2547 | linkPart.PhysActor.link(m_rootPart.PhysActor); | ||
2548 | this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor); | ||
2549 | } | ||
2550 | |||
2531 | linkPart.LinkNum = linkNum++; | 2551 | linkPart.LinkNum = linkNum++; |
2532 | 2552 | ||
2533 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2553 | SceneObjectPart[] ogParts = objectGroup.Parts; |
@@ -2540,7 +2560,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2540 | { | 2560 | { |
2541 | SceneObjectPart part = ogParts[i]; | 2561 | SceneObjectPart part = ogParts[i]; |
2542 | if (part.UUID != objectGroup.m_rootPart.UUID) | 2562 | if (part.UUID != objectGroup.m_rootPart.UUID) |
2563 | { | ||
2543 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); | 2564 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); |
2565 | // let physics know | ||
2566 | if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2567 | { | ||
2568 | part.PhysActor.link(m_rootPart.PhysActor); | ||
2569 | this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | ||
2570 | } | ||
2571 | } | ||
2544 | part.ClearUndoState(); | 2572 | part.ClearUndoState(); |
2545 | } | 2573 | } |
2546 | } | 2574 | } |
@@ -2560,6 +2588,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2560 | // unmoved prims! | 2588 | // unmoved prims! |
2561 | ResetChildPrimPhysicsPositions(); | 2589 | ResetChildPrimPhysicsPositions(); |
2562 | 2590 | ||
2591 | if (m_rootPart.PhysActor != null) | ||
2592 | m_rootPart.PhysActor.Building = false; | ||
2593 | |||
2563 | //HasGroupChanged = true; | 2594 | //HasGroupChanged = true; |
2564 | //ScheduleGroupForFullUpdate(); | 2595 | //ScheduleGroupForFullUpdate(); |
2565 | } | 2596 | } |
@@ -2612,7 +2643,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2612 | // m_log.DebugFormat( | 2643 | // m_log.DebugFormat( |
2613 | // "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", | 2644 | // "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", |
2614 | // linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); | 2645 | // linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); |
2615 | 2646 | ||
2647 | if (m_rootPart.PhysActor != null) | ||
2648 | m_rootPart.PhysActor.Building = true; | ||
2649 | |||
2616 | linkPart.ClearUndoState(); | 2650 | linkPart.ClearUndoState(); |
2617 | 2651 | ||
2618 | Quaternion worldRot = linkPart.GetWorldRotation(); | 2652 | Quaternion worldRot = linkPart.GetWorldRotation(); |
@@ -2672,6 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2672 | 2706 | ||
2673 | // When we delete a group, we currently have to force persist to the database if the object id has changed | 2707 | // When we delete a group, we currently have to force persist to the database if the object id has changed |
2674 | // (since delete works by deleting all rows which have a given object id) | 2708 | // (since delete works by deleting all rows which have a given object id) |
2709 | |||
2710 | if (m_rootPart.PhysActor != null) | ||
2711 | m_rootPart.PhysActor.Building = false; | ||
2712 | |||
2675 | objectGroup.HasGroupChangedDueToDelink = true; | 2713 | objectGroup.HasGroupChangedDueToDelink = true; |
2676 | 2714 | ||
2677 | return objectGroup; | 2715 | return objectGroup; |
@@ -3284,6 +3322,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3284 | part.StoreUndoState(false); | 3322 | part.StoreUndoState(false); |
3285 | part.IgnoreUndoUpdate = true; | 3323 | part.IgnoreUndoUpdate = true; |
3286 | 3324 | ||
3325 | // unlock parts position change | ||
3326 | if (m_rootPart.PhysActor != null) | ||
3327 | m_rootPart.PhysActor.Building = true; | ||
3328 | |||
3287 | if (part.UUID == m_rootPart.UUID) | 3329 | if (part.UUID == m_rootPart.UUID) |
3288 | { | 3330 | { |
3289 | UpdateRootPosition(pos); | 3331 | UpdateRootPosition(pos); |
@@ -3293,6 +3335,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3293 | part.UpdateOffSet(pos); | 3335 | part.UpdateOffSet(pos); |
3294 | } | 3336 | } |
3295 | 3337 | ||
3338 | if (m_rootPart.PhysActor != null) | ||
3339 | m_rootPart.PhysActor.Building = false; | ||
3340 | |||
3296 | HasGroupChanged = true; | 3341 | HasGroupChanged = true; |
3297 | part.IgnoreUndoUpdate = false; | 3342 | part.IgnoreUndoUpdate = false; |
3298 | } | 3343 | } |
@@ -3434,6 +3479,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3434 | // m_log.DebugFormat( | 3479 | // m_log.DebugFormat( |
3435 | // "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); | 3480 | // "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); |
3436 | 3481 | ||
3482 | if (m_rootPart.PhysActor != null) | ||
3483 | m_rootPart.PhysActor.Building = true; | ||
3484 | |||
3437 | if (part.UUID == m_rootPart.UUID) | 3485 | if (part.UUID == m_rootPart.UUID) |
3438 | { | 3486 | { |
3439 | UpdateRootRotation(rot); | 3487 | UpdateRootRotation(rot); |
@@ -3442,6 +3490,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3442 | { | 3490 | { |
3443 | part.UpdateRotation(rot); | 3491 | part.UpdateRotation(rot); |
3444 | } | 3492 | } |
3493 | |||
3494 | if (m_rootPart.PhysActor != null) | ||
3495 | m_rootPart.PhysActor.Building = false; | ||
3445 | } | 3496 | } |
3446 | } | 3497 | } |
3447 | 3498 | ||
@@ -3462,6 +3513,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3462 | part.StoreUndoState(); | 3513 | part.StoreUndoState(); |
3463 | part.IgnoreUndoUpdate = true; | 3514 | part.IgnoreUndoUpdate = true; |
3464 | 3515 | ||
3516 | if (m_rootPart.PhysActor != null) | ||
3517 | m_rootPart.PhysActor.Building = true; | ||
3518 | |||
3465 | if (part.UUID == m_rootPart.UUID) | 3519 | if (part.UUID == m_rootPart.UUID) |
3466 | { | 3520 | { |
3467 | UpdateRootRotation(rot); | 3521 | UpdateRootRotation(rot); |
@@ -3482,6 +3536,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3482 | part.OffsetPosition = pos; | 3536 | part.OffsetPosition = pos; |
3483 | } | 3537 | } |
3484 | 3538 | ||
3539 | if (m_rootPart.PhysActor != null) | ||
3540 | m_rootPart.PhysActor.Building = false; | ||
3541 | |||
3485 | part.IgnoreUndoUpdate = false; | 3542 | part.IgnoreUndoUpdate = false; |
3486 | } | 3543 | } |
3487 | } | 3544 | } |