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 4798481..bf898bb 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 | ||
@@ -3464,27 +3483,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | /// <param name="scale"></param> | 3483 | /// <param name="scale"></param> |
3465 | public void GroupResize(Vector3 scale) | 3484 | public void GroupResize(Vector3 scale) |
3466 | { | 3485 | { |
3467 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 3486 | // m_log.DebugFormat( |
3468 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 3487 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); |
3469 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | ||
3470 | 3488 | ||
3471 | PhysicsActor pa = m_rootPart.PhysActor; | 3489 | PhysicsActor pa = m_rootPart.PhysActor; |
3472 | 3490 | ||
3473 | if (pa != null && pa.IsPhysical) | 3491 | if (Scene != null) |
3474 | { | 3492 | { |
3475 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); | 3493 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); |
3476 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); | 3494 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); |
3477 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); | 3495 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); |
3496 | |||
3497 | if (pa != null && pa.IsPhysical) | ||
3498 | { | ||
3499 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); | ||
3500 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); | ||
3501 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); | ||
3502 | } | ||
3478 | } | 3503 | } |
3479 | 3504 | ||
3480 | float x = (scale.X / RootPart.Scale.X); | 3505 | float x = (scale.X / RootPart.Scale.X); |
3481 | float y = (scale.Y / RootPart.Scale.Y); | 3506 | float y = (scale.Y / RootPart.Scale.Y); |
3482 | float z = (scale.Z / RootPart.Scale.Z); | 3507 | float z = (scale.Z / RootPart.Scale.Z); |
3483 | 3508 | ||
3484 | SceneObjectPart[] parts; | 3509 | SceneObjectPart[] parts = m_parts.GetArray(); |
3485 | if (x > 1.0f || y > 1.0f || z > 1.0f) | 3510 | |
3511 | if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f)) | ||
3486 | { | 3512 | { |
3487 | parts = m_parts.GetArray(); | ||
3488 | for (int i = 0; i < parts.Length; i++) | 3513 | for (int i = 0; i < parts.Length; i++) |
3489 | { | 3514 | { |
3490 | SceneObjectPart obPart = parts[i]; | 3515 | SceneObjectPart obPart = parts[i]; |
@@ -3497,7 +3522,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | 3522 | ||
3498 | if (pa != null && pa.IsPhysical) | 3523 | if (pa != null && pa.IsPhysical) |
3499 | { | 3524 | { |
3500 | if (oldSize.X * x > m_scene.m_maxPhys) | 3525 | if (oldSize.X * x > Scene.m_maxPhys) |
3501 | { | 3526 | { |
3502 | f = m_scene.m_maxPhys / oldSize.X; | 3527 | f = m_scene.m_maxPhys / oldSize.X; |
3503 | a = f / x; | 3528 | a = f / x; |
@@ -3505,8 +3530,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3505 | y *= a; | 3530 | y *= a; |
3506 | z *= a; | 3531 | z *= a; |
3507 | } | 3532 | } |
3533 | else if (oldSize.X * x < Scene.m_minPhys) | ||
3534 | { | ||
3535 | f = m_scene.m_minPhys / oldSize.X; | ||
3536 | a = f / x; | ||
3537 | x *= a; | ||
3538 | y *= a; | ||
3539 | z *= a; | ||
3540 | } | ||
3508 | 3541 | ||
3509 | if (oldSize.Y * y > m_scene.m_maxPhys) | 3542 | if (oldSize.Y * y > Scene.m_maxPhys) |
3510 | { | 3543 | { |
3511 | f = m_scene.m_maxPhys / oldSize.Y; | 3544 | f = m_scene.m_maxPhys / oldSize.Y; |
3512 | a = f / y; | 3545 | a = f / y; |
@@ -3514,8 +3547,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3514 | y *= a; | 3547 | y *= a; |
3515 | z *= a; | 3548 | z *= a; |
3516 | } | 3549 | } |
3550 | else if (oldSize.Y * y < Scene.m_minPhys) | ||
3551 | { | ||
3552 | f = m_scene.m_minPhys / oldSize.Y; | ||
3553 | a = f / y; | ||
3554 | x *= a; | ||
3555 | y *= a; | ||
3556 | z *= a; | ||
3557 | } | ||
3517 | 3558 | ||
3518 | if (oldSize.Z * z > m_scene.m_maxPhys) | 3559 | if (oldSize.Z * z > Scene.m_maxPhys) |
3519 | { | 3560 | { |
3520 | f = m_scene.m_maxPhys / oldSize.Z; | 3561 | f = m_scene.m_maxPhys / oldSize.Z; |
3521 | a = f / z; | 3562 | a = f / z; |
@@ -3523,10 +3564,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3523 | y *= a; | 3564 | y *= a; |
3524 | z *= a; | 3565 | z *= a; |
3525 | } | 3566 | } |
3567 | else if (oldSize.Z * z < Scene.m_minPhys) | ||
3568 | { | ||
3569 | f = m_scene.m_minPhys / oldSize.Z; | ||
3570 | a = f / z; | ||
3571 | x *= a; | ||
3572 | y *= a; | ||
3573 | z *= a; | ||
3574 | } | ||
3526 | } | 3575 | } |
3527 | else | 3576 | else |
3528 | { | 3577 | { |
3529 | if (oldSize.X * x > m_scene.m_maxNonphys) | 3578 | if (oldSize.X * x > Scene.m_maxNonphys) |
3530 | { | 3579 | { |
3531 | f = m_scene.m_maxNonphys / oldSize.X; | 3580 | f = m_scene.m_maxNonphys / oldSize.X; |
3532 | a = f / x; | 3581 | a = f / x; |
@@ -3534,8 +3583,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3534 | y *= a; | 3583 | y *= a; |
3535 | z *= a; | 3584 | z *= a; |
3536 | } | 3585 | } |
3586 | else if (oldSize.X * x < Scene.m_minNonphys) | ||
3587 | { | ||
3588 | f = m_scene.m_minNonphys / oldSize.X; | ||
3589 | a = f / x; | ||
3590 | x *= a; | ||
3591 | y *= a; | ||
3592 | z *= a; | ||
3593 | } | ||
3537 | 3594 | ||
3538 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 3595 | if (oldSize.Y * y > Scene.m_maxNonphys) |
3539 | { | 3596 | { |
3540 | f = m_scene.m_maxNonphys / oldSize.Y; | 3597 | f = m_scene.m_maxNonphys / oldSize.Y; |
3541 | a = f / y; | 3598 | a = f / y; |
@@ -3543,8 +3600,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3543 | y *= a; | 3600 | y *= a; |
3544 | z *= a; | 3601 | z *= a; |
3545 | } | 3602 | } |
3603 | else if (oldSize.Y * y < Scene.m_minNonphys) | ||
3604 | { | ||
3605 | f = m_scene.m_minNonphys / oldSize.Y; | ||
3606 | a = f / y; | ||
3607 | x *= a; | ||
3608 | y *= a; | ||
3609 | z *= a; | ||
3610 | } | ||
3546 | 3611 | ||
3547 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 3612 | if (oldSize.Z * z > Scene.m_maxNonphys) |
3548 | { | 3613 | { |
3549 | f = m_scene.m_maxNonphys / oldSize.Z; | 3614 | f = m_scene.m_maxNonphys / oldSize.Z; |
3550 | a = f / z; | 3615 | a = f / z; |
@@ -3552,6 +3617,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3552 | y *= a; | 3617 | y *= a; |
3553 | z *= a; | 3618 | z *= a; |
3554 | } | 3619 | } |
3620 | else if (oldSize.Z * z < Scene.m_minNonphys) | ||
3621 | { | ||
3622 | f = m_scene.m_minNonphys / oldSize.Z; | ||
3623 | a = f / z; | ||
3624 | x *= a; | ||
3625 | y *= a; | ||
3626 | z *= a; | ||
3627 | } | ||
3555 | } | 3628 | } |
3556 | } | 3629 | } |
3557 | } | 3630 | } |
@@ -3564,7 +3637,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3564 | 3637 | ||
3565 | RootPart.Resize(prevScale); | 3638 | RootPart.Resize(prevScale); |
3566 | 3639 | ||
3567 | parts = m_parts.GetArray(); | ||
3568 | for (int i = 0; i < parts.Length; i++) | 3640 | for (int i = 0; i < parts.Length; i++) |
3569 | { | 3641 | { |
3570 | SceneObjectPart obPart = parts[i]; | 3642 | SceneObjectPart obPart = parts[i]; |