diff options
author | Justin Clark-Casey (justincc) | 2012-09-26 23:17:21 +0100 |
---|---|---|
committer | Melanie | 2012-09-27 15:48:47 +0100 |
commit | 9eca154bced7423867e8f9597b8baf214de79087 (patch) | |
tree | ffbb038aebe837ee5ec560a607eb55891cdb3ca5 /OpenSim | |
parent | Merge commit '327320d1a7acbba969d26c281f92f64ce8ff365f' into careminster (diff) | |
download | opensim-SC-9eca154bced7423867e8f9597b8baf214de79087.zip opensim-SC-9eca154bced7423867e8f9597b8baf214de79087.tar.gz opensim-SC-9eca154bced7423867e8f9597b8baf214de79087.tar.bz2 opensim-SC-9eca154bced7423867e8f9597b8baf214de79087.tar.xz |
Make it possible to rescale SOGs when they are not in a scene.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 |
2 files changed, 42 insertions, 31 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f1df6d6..ddcc956 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3483,27 +3483,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
3483 | /// <param name="scale"></param> | 3483 | /// <param name="scale"></param> |
3484 | public void GroupResize(Vector3 scale) | 3484 | public void GroupResize(Vector3 scale) |
3485 | { | 3485 | { |
3486 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); | 3486 | // m_log.DebugFormat( |
3487 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); | 3487 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); |
3488 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); | ||
3489 | 3488 | ||
3490 | PhysicsActor pa = m_rootPart.PhysActor; | 3489 | PhysicsActor pa = m_rootPart.PhysActor; |
3491 | 3490 | ||
3492 | if (pa != null && pa.IsPhysical) | 3491 | RootPart.StoreUndoState(true); |
3492 | |||
3493 | if (Scene != null) | ||
3493 | { | 3494 | { |
3494 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); | 3495 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); |
3495 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); | 3496 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); |
3496 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); | 3497 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); |
3498 | |||
3499 | if (pa != null && pa.IsPhysical) | ||
3500 | { | ||
3501 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); | ||
3502 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); | ||
3503 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); | ||
3504 | } | ||
3497 | } | 3505 | } |
3498 | 3506 | ||
3499 | float x = (scale.X / RootPart.Scale.X); | 3507 | float x = (scale.X / RootPart.Scale.X); |
3500 | float y = (scale.Y / RootPart.Scale.Y); | 3508 | float y = (scale.Y / RootPart.Scale.Y); |
3501 | float z = (scale.Z / RootPart.Scale.Z); | 3509 | float z = (scale.Z / RootPart.Scale.Z); |
3502 | 3510 | ||
3503 | SceneObjectPart[] parts; | 3511 | SceneObjectPart[] parts = m_parts.GetArray(); |
3504 | if (x > 1.0f || y > 1.0f || z > 1.0f) | 3512 | |
3513 | if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f)) | ||
3505 | { | 3514 | { |
3506 | parts = m_parts.GetArray(); | ||
3507 | for (int i = 0; i < parts.Length; i++) | 3515 | for (int i = 0; i < parts.Length; i++) |
3508 | { | 3516 | { |
3509 | SceneObjectPart obPart = parts[i]; | 3517 | SceneObjectPart obPart = parts[i]; |
@@ -3516,7 +3524,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3516 | 3524 | ||
3517 | if (pa != null && pa.IsPhysical) | 3525 | if (pa != null && pa.IsPhysical) |
3518 | { | 3526 | { |
3519 | if (oldSize.X * x > m_scene.m_maxPhys) | 3527 | if (oldSize.X * x > Scene.m_maxPhys) |
3520 | { | 3528 | { |
3521 | f = m_scene.m_maxPhys / oldSize.X; | 3529 | f = m_scene.m_maxPhys / oldSize.X; |
3522 | a = f / x; | 3530 | a = f / x; |
@@ -3524,7 +3532,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3524 | y *= a; | 3532 | y *= a; |
3525 | z *= a; | 3533 | z *= a; |
3526 | } | 3534 | } |
3527 | else if (oldSize.X * x < m_scene.m_minPhys) | 3535 | else if (oldSize.X * x < Scene.m_minPhys) |
3528 | { | 3536 | { |
3529 | f = m_scene.m_minPhys / oldSize.X; | 3537 | f = m_scene.m_minPhys / oldSize.X; |
3530 | a = f / x; | 3538 | a = f / x; |
@@ -3533,7 +3541,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3533 | z *= a; | 3541 | z *= a; |
3534 | } | 3542 | } |
3535 | 3543 | ||
3536 | if (oldSize.Y * y > m_scene.m_maxPhys) | 3544 | if (oldSize.Y * y > Scene.m_maxPhys) |
3537 | { | 3545 | { |
3538 | f = m_scene.m_maxPhys / oldSize.Y; | 3546 | f = m_scene.m_maxPhys / oldSize.Y; |
3539 | a = f / y; | 3547 | a = f / y; |
@@ -3541,7 +3549,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3541 | y *= a; | 3549 | y *= a; |
3542 | z *= a; | 3550 | z *= a; |
3543 | } | 3551 | } |
3544 | else if (oldSize.Y * y < m_scene.m_minPhys) | 3552 | else if (oldSize.Y * y < Scene.m_minPhys) |
3545 | { | 3553 | { |
3546 | f = m_scene.m_minPhys / oldSize.Y; | 3554 | f = m_scene.m_minPhys / oldSize.Y; |
3547 | a = f / y; | 3555 | a = f / y; |
@@ -3550,7 +3558,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3550 | z *= a; | 3558 | z *= a; |
3551 | } | 3559 | } |
3552 | 3560 | ||
3553 | if (oldSize.Z * z > m_scene.m_maxPhys) | 3561 | if (oldSize.Z * z > Scene.m_maxPhys) |
3554 | { | 3562 | { |
3555 | f = m_scene.m_maxPhys / oldSize.Z; | 3563 | f = m_scene.m_maxPhys / oldSize.Z; |
3556 | a = f / z; | 3564 | a = f / z; |
@@ -3558,7 +3566,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3558 | y *= a; | 3566 | y *= a; |
3559 | z *= a; | 3567 | z *= a; |
3560 | } | 3568 | } |
3561 | else if (oldSize.Z * z < m_scene.m_minPhys) | 3569 | else if (oldSize.Z * z < Scene.m_minPhys) |
3562 | { | 3570 | { |
3563 | f = m_scene.m_minPhys / oldSize.Z; | 3571 | f = m_scene.m_minPhys / oldSize.Z; |
3564 | a = f / z; | 3572 | a = f / z; |
@@ -3569,7 +3577,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3569 | } | 3577 | } |
3570 | else | 3578 | else |
3571 | { | 3579 | { |
3572 | if (oldSize.X * x > m_scene.m_maxNonphys) | 3580 | if (oldSize.X * x > Scene.m_maxNonphys) |
3573 | { | 3581 | { |
3574 | f = m_scene.m_maxNonphys / oldSize.X; | 3582 | f = m_scene.m_maxNonphys / oldSize.X; |
3575 | a = f / x; | 3583 | a = f / x; |
@@ -3577,7 +3585,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3577 | y *= a; | 3585 | y *= a; |
3578 | z *= a; | 3586 | z *= a; |
3579 | } | 3587 | } |
3580 | else if (oldSize.X * x < m_scene.m_minNonphys) | 3588 | else if (oldSize.X * x < Scene.m_minNonphys) |
3581 | { | 3589 | { |
3582 | f = m_scene.m_minNonphys / oldSize.X; | 3590 | f = m_scene.m_minNonphys / oldSize.X; |
3583 | a = f / x; | 3591 | a = f / x; |
@@ -3586,7 +3594,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3586 | z *= a; | 3594 | z *= a; |
3587 | } | 3595 | } |
3588 | 3596 | ||
3589 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 3597 | if (oldSize.Y * y > Scene.m_maxNonphys) |
3590 | { | 3598 | { |
3591 | f = m_scene.m_maxNonphys / oldSize.Y; | 3599 | f = m_scene.m_maxNonphys / oldSize.Y; |
3592 | a = f / y; | 3600 | a = f / y; |
@@ -3594,7 +3602,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3594 | y *= a; | 3602 | y *= a; |
3595 | z *= a; | 3603 | z *= a; |
3596 | } | 3604 | } |
3597 | else if (oldSize.Y * y < m_scene.m_minNonphys) | 3605 | else if (oldSize.Y * y < Scene.m_minNonphys) |
3598 | { | 3606 | { |
3599 | f = m_scene.m_minNonphys / oldSize.Y; | 3607 | f = m_scene.m_minNonphys / oldSize.Y; |
3600 | a = f / y; | 3608 | a = f / y; |
@@ -3603,7 +3611,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3603 | z *= a; | 3611 | z *= a; |
3604 | } | 3612 | } |
3605 | 3613 | ||
3606 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 3614 | if (oldSize.Z * z > Scene.m_maxNonphys) |
3607 | { | 3615 | { |
3608 | f = m_scene.m_maxNonphys / oldSize.Z; | 3616 | f = m_scene.m_maxNonphys / oldSize.Z; |
3609 | a = f / z; | 3617 | a = f / z; |
@@ -3611,7 +3619,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | y *= a; | 3619 | y *= a; |
3612 | z *= a; | 3620 | z *= a; |
3613 | } | 3621 | } |
3614 | else if (oldSize.Z * z < m_scene.m_minNonphys) | 3622 | else if (oldSize.Z * z < Scene.m_minNonphys) |
3615 | { | 3623 | { |
3616 | f = m_scene.m_minNonphys / oldSize.Z; | 3624 | f = m_scene.m_minNonphys / oldSize.Z; |
3617 | a = f / z; | 3625 | a = f / z; |
@@ -3631,7 +3639,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3631 | 3639 | ||
3632 | RootPart.Resize(prevScale); | 3640 | RootPart.Resize(prevScale); |
3633 | 3641 | ||
3634 | parts = m_parts.GetArray(); | ||
3635 | for (int i = 0; i < parts.Length; i++) | 3642 | for (int i = 0; i < parts.Length; i++) |
3636 | { | 3643 | { |
3637 | SceneObjectPart obPart = parts[i]; | 3644 | SceneObjectPart obPart = parts[i]; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4af508e..44573eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2972,16 +2972,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2972 | /// <param name="scale"></param> | 2972 | /// <param name="scale"></param> |
2973 | public void Resize(Vector3 scale) | 2973 | public void Resize(Vector3 scale) |
2974 | { | 2974 | { |
2975 | scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); | ||
2976 | scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); | ||
2977 | scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); | ||
2978 | |||
2979 | PhysicsActor pa = PhysActor; | 2975 | PhysicsActor pa = PhysActor; |
2980 | if (pa != null && pa.IsPhysical) | 2976 | |
2977 | if (ParentGroup.Scene != null) | ||
2981 | { | 2978 | { |
2982 | scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); | 2979 | scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); |
2983 | scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); | 2980 | scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); |
2984 | scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); | 2981 | scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); |
2982 | |||
2983 | if (pa != null && pa.IsPhysical) | ||
2984 | { | ||
2985 | scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); | ||
2986 | scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); | ||
2987 | scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); | ||
2988 | } | ||
2985 | } | 2989 | } |
2986 | 2990 | ||
2987 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | 2991 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); |