diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 106 |
1 files changed, 89 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e94ecee..b9f9c86 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2752,6 +2752,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2752 | if (objectGroup == this) | 2752 | if (objectGroup == this) |
2753 | return; | 2753 | return; |
2754 | 2754 | ||
2755 | // If the configured linkset capacity is greater than zero, | ||
2756 | // and the new linkset would have a prim count higher than this | ||
2757 | // value, do not link it. | ||
2758 | if (m_scene.m_linksetCapacity > 0 && | ||
2759 | (PrimCount + objectGroup.PrimCount) > | ||
2760 | m_scene.m_linksetCapacity) | ||
2761 | { | ||
2762 | m_log.DebugFormat( | ||
2763 | "[SCENE OBJECT GROUP]: Cannot link group with root" + | ||
2764 | " part {0}, {1} ({2} prims) to group with root part" + | ||
2765 | " {3}, {4} ({5} prims) because the new linkset" + | ||
2766 | " would exceed the configured maximum of {6}", | ||
2767 | objectGroup.RootPart.Name, objectGroup.RootPart.UUID, | ||
2768 | objectGroup.PrimCount, RootPart.Name, RootPart.UUID, | ||
2769 | PrimCount, m_scene.m_linksetCapacity); | ||
2770 | |||
2771 | return; | ||
2772 | } | ||
2773 | |||
2755 | // 'linkPart' == the root of the group being linked into this group | 2774 | // 'linkPart' == the root of the group being linked into this group |
2756 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 2775 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
2757 | 2776 | ||
@@ -3497,27 +3516,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | /// <param name="scale"></param> | 3516 | /// <param name="scale"></param> |
3498 | public void GroupResize(Vector3 scale) | 3517 | public void GroupResize(Vector3 scale) |
3499 | { | 3518 | { |
3500 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 3519 | // m_log.DebugFormat( |
3501 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 3520 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); |
3502 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | ||
3503 | 3521 | ||
3504 | PhysicsActor pa = m_rootPart.PhysActor; | 3522 | PhysicsActor pa = m_rootPart.PhysActor; |
3505 | 3523 | ||
3506 | if (pa != null && pa.IsPhysical) | 3524 | if (Scene != null) |
3507 | { | 3525 | { |
3508 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); | 3526 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); |
3509 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); | 3527 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); |
3510 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); | 3528 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); |
3529 | |||
3530 | if (pa != null && pa.IsPhysical) | ||
3531 | { | ||
3532 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); | ||
3533 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); | ||
3534 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); | ||
3535 | } | ||
3511 | } | 3536 | } |
3512 | 3537 | ||
3513 | float x = (scale.X / RootPart.Scale.X); | 3538 | float x = (scale.X / RootPart.Scale.X); |
3514 | float y = (scale.Y / RootPart.Scale.Y); | 3539 | float y = (scale.Y / RootPart.Scale.Y); |
3515 | float z = (scale.Z / RootPart.Scale.Z); | 3540 | float z = (scale.Z / RootPart.Scale.Z); |
3516 | 3541 | ||
3517 | SceneObjectPart[] parts; | 3542 | SceneObjectPart[] parts = m_parts.GetArray(); |
3518 | if (x > 1.0f || y > 1.0f || z > 1.0f) | 3543 | |
3544 | if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f)) | ||
3519 | { | 3545 | { |
3520 | parts = m_parts.GetArray(); | ||
3521 | for (int i = 0; i < parts.Length; i++) | 3546 | for (int i = 0; i < parts.Length; i++) |
3522 | { | 3547 | { |
3523 | SceneObjectPart obPart = parts[i]; | 3548 | SceneObjectPart obPart = parts[i]; |
@@ -3530,7 +3555,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3530 | 3555 | ||
3531 | if (pa != null && pa.IsPhysical) | 3556 | if (pa != null && pa.IsPhysical) |
3532 | { | 3557 | { |
3533 | if (oldSize.X * x > m_scene.m_maxPhys) | 3558 | if (oldSize.X * x > Scene.m_maxPhys) |
3534 | { | 3559 | { |
3535 | f = m_scene.m_maxPhys / oldSize.X; | 3560 | f = m_scene.m_maxPhys / oldSize.X; |
3536 | a = f / x; | 3561 | a = f / x; |
@@ -3538,8 +3563,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3538 | y *= a; | 3563 | y *= a; |
3539 | z *= a; | 3564 | z *= a; |
3540 | } | 3565 | } |
3566 | else if (oldSize.X * x < Scene.m_minPhys) | ||
3567 | { | ||
3568 | f = m_scene.m_minPhys / oldSize.X; | ||
3569 | a = f / x; | ||
3570 | x *= a; | ||
3571 | y *= a; | ||
3572 | z *= a; | ||
3573 | } | ||
3541 | 3574 | ||
3542 | if (oldSize.Y * y > m_scene.m_maxPhys) | 3575 | if (oldSize.Y * y > Scene.m_maxPhys) |
3543 | { | 3576 | { |
3544 | f = m_scene.m_maxPhys / oldSize.Y; | 3577 | f = m_scene.m_maxPhys / oldSize.Y; |
3545 | a = f / y; | 3578 | a = f / y; |
@@ -3547,8 +3580,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3547 | y *= a; | 3580 | y *= a; |
3548 | z *= a; | 3581 | z *= a; |
3549 | } | 3582 | } |
3583 | else if (oldSize.Y * y < Scene.m_minPhys) | ||
3584 | { | ||
3585 | f = m_scene.m_minPhys / oldSize.Y; | ||
3586 | a = f / y; | ||
3587 | x *= a; | ||
3588 | y *= a; | ||
3589 | z *= a; | ||
3590 | } | ||
3550 | 3591 | ||
3551 | if (oldSize.Z * z > m_scene.m_maxPhys) | 3592 | if (oldSize.Z * z > Scene.m_maxPhys) |
3552 | { | 3593 | { |
3553 | f = m_scene.m_maxPhys / oldSize.Z; | 3594 | f = m_scene.m_maxPhys / oldSize.Z; |
3554 | a = f / z; | 3595 | a = f / z; |
@@ -3556,10 +3597,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3556 | y *= a; | 3597 | y *= a; |
3557 | z *= a; | 3598 | z *= a; |
3558 | } | 3599 | } |
3600 | else if (oldSize.Z * z < Scene.m_minPhys) | ||
3601 | { | ||
3602 | f = m_scene.m_minPhys / oldSize.Z; | ||
3603 | a = f / z; | ||
3604 | x *= a; | ||
3605 | y *= a; | ||
3606 | z *= a; | ||
3607 | } | ||
3559 | } | 3608 | } |
3560 | else | 3609 | else |
3561 | { | 3610 | { |
3562 | if (oldSize.X * x > m_scene.m_maxNonphys) | 3611 | if (oldSize.X * x > Scene.m_maxNonphys) |
3563 | { | 3612 | { |
3564 | f = m_scene.m_maxNonphys / oldSize.X; | 3613 | f = m_scene.m_maxNonphys / oldSize.X; |
3565 | a = f / x; | 3614 | a = f / x; |
@@ -3567,8 +3616,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3567 | y *= a; | 3616 | y *= a; |
3568 | z *= a; | 3617 | z *= a; |
3569 | } | 3618 | } |
3619 | else if (oldSize.X * x < Scene.m_minNonphys) | ||
3620 | { | ||
3621 | f = m_scene.m_minNonphys / oldSize.X; | ||
3622 | a = f / x; | ||
3623 | x *= a; | ||
3624 | y *= a; | ||
3625 | z *= a; | ||
3626 | } | ||
3570 | 3627 | ||
3571 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 3628 | if (oldSize.Y * y > Scene.m_maxNonphys) |
3572 | { | 3629 | { |
3573 | f = m_scene.m_maxNonphys / oldSize.Y; | 3630 | f = m_scene.m_maxNonphys / oldSize.Y; |
3574 | a = f / y; | 3631 | a = f / y; |
@@ -3576,8 +3633,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3576 | y *= a; | 3633 | y *= a; |
3577 | z *= a; | 3634 | z *= a; |
3578 | } | 3635 | } |
3636 | else if (oldSize.Y * y < Scene.m_minNonphys) | ||
3637 | { | ||
3638 | f = m_scene.m_minNonphys / oldSize.Y; | ||
3639 | a = f / y; | ||
3640 | x *= a; | ||
3641 | y *= a; | ||
3642 | z *= a; | ||
3643 | } | ||
3579 | 3644 | ||
3580 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 3645 | if (oldSize.Z * z > Scene.m_maxNonphys) |
3581 | { | 3646 | { |
3582 | f = m_scene.m_maxNonphys / oldSize.Z; | 3647 | f = m_scene.m_maxNonphys / oldSize.Z; |
3583 | a = f / z; | 3648 | a = f / z; |
@@ -3585,6 +3650,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3585 | y *= a; | 3650 | y *= a; |
3586 | z *= a; | 3651 | z *= a; |
3587 | } | 3652 | } |
3653 | else if (oldSize.Z * z < Scene.m_minNonphys) | ||
3654 | { | ||
3655 | f = m_scene.m_minNonphys / oldSize.Z; | ||
3656 | a = f / z; | ||
3657 | x *= a; | ||
3658 | y *= a; | ||
3659 | z *= a; | ||
3660 | } | ||
3588 | } | 3661 | } |
3589 | } | 3662 | } |
3590 | } | 3663 | } |
@@ -3597,7 +3670,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3597 | 3670 | ||
3598 | RootPart.Resize(prevScale); | 3671 | RootPart.Resize(prevScale); |
3599 | 3672 | ||
3600 | parts = m_parts.GetArray(); | ||
3601 | for (int i = 0; i < parts.Length; i++) | 3673 | for (int i = 0; i < parts.Length; i++) |
3602 | { | 3674 | { |
3603 | SceneObjectPart obPart = parts[i]; | 3675 | SceneObjectPart obPart = parts[i]; |