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