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