aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs121
1 files changed, 99 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ee61de6..b9f9c86 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.Framework.Scenes
112 private long timeLastChanged = 0; 112 private long timeLastChanged = 0;
113 private long m_maxPersistTime = 0; 113 private long m_maxPersistTime = 0;
114 private long m_minPersistTime = 0; 114 private long m_minPersistTime = 0;
115 private Random m_rand; 115// private Random m_rand;
116 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); 116 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
117 117
118 /// <summary> 118 /// <summary>
@@ -130,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes
130 { 130 {
131 if (value) 131 if (value)
132 { 132 {
133
133 if (m_isBackedUp) 134 if (m_isBackedUp)
134 { 135 {
135 m_scene.SceneGraph.FireChangeBackup(this); 136 m_scene.SceneGraph.FireChangeBackup(this);
@@ -139,19 +140,21 @@ namespace OpenSim.Region.Framework.Scenes
139 timeFirstChanged = DateTime.Now.Ticks; 140 timeFirstChanged = DateTime.Now.Ticks;
140 if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) 141 if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
141 { 142 {
143/*
142 if (m_rand == null) 144 if (m_rand == null)
143 { 145 {
144 byte[] val = new byte[16]; 146 byte[] val = new byte[16];
145 m_rootPart.UUID.ToBytes(val, 0); 147 m_rootPart.UUID.ToBytes(val, 0);
146 m_rand = new Random(BitConverter.ToInt32(val, 0)); 148 m_rand = new Random(BitConverter.ToInt32(val, 0));
147 } 149 }
148 150 */
149 if (m_scene.GetRootAgentCount() == 0) 151 if (m_scene.GetRootAgentCount() == 0)
150 { 152 {
151 //If the region is empty, this change has been made by an automated process 153 //If the region is empty, this change has been made by an automated process
152 //and thus we delay the persist time by a random amount between 1.5 and 2.5. 154 //and thus we delay the persist time by a random amount between 1.5 and 2.5.
153 155
154 float factor = 1.5f + (float)(m_rand.NextDouble()); 156// float factor = 1.5f + (float)(m_rand.NextDouble());
157 float factor = 2.0f;
155 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); 158 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor);
156 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); 159 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor);
157 } 160 }
@@ -159,8 +162,10 @@ namespace OpenSim.Region.Framework.Scenes
159 { 162 {
160 //If the region is not empty, we want to obey the minimum and maximum persist times 163 //If the region is not empty, we want to obey the minimum and maximum persist times
161 //but add a random factor so we stagger the object persistance a little 164 //but add a random factor so we stagger the object persistance a little
162 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 165// m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5
163 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 166// m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0
167 m_maxPersistTime = m_scene.m_persistAfter;
168 m_minPersistTime = m_scene.m_dontPersistBefore;
164 } 169 }
165 } 170 }
166 } 171 }
@@ -2747,6 +2752,25 @@ namespace OpenSim.Region.Framework.Scenes
2747 if (objectGroup == this) 2752 if (objectGroup == this)
2748 return; 2753 return;
2749 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
2750 // 'linkPart' == the root of the group being linked into this group 2774 // 'linkPart' == the root of the group being linked into this group
2751 SceneObjectPart linkPart = objectGroup.m_rootPart; 2775 SceneObjectPart linkPart = objectGroup.m_rootPart;
2752 2776
@@ -3492,27 +3516,33 @@ namespace OpenSim.Region.Framework.Scenes
3492 /// <param name="scale"></param> 3516 /// <param name="scale"></param>
3493 public void GroupResize(Vector3 scale) 3517 public void GroupResize(Vector3 scale)
3494 { 3518 {
3495 scale.X = Math.Min(scale.X, Scene.m_maxNonphys); 3519// m_log.DebugFormat(
3496 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);
3497 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
3498 3521
3499 PhysicsActor pa = m_rootPart.PhysActor; 3522 PhysicsActor pa = m_rootPart.PhysActor;
3500 3523
3501 if (pa != null && pa.IsPhysical) 3524 if (Scene != null)
3502 { 3525 {
3503 scale.X = Math.Min(scale.X, Scene.m_maxPhys); 3526 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
3504 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); 3527 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
3505 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 }
3506 } 3536 }
3507 3537
3508 float x = (scale.X / RootPart.Scale.X); 3538 float x = (scale.X / RootPart.Scale.X);
3509 float y = (scale.Y / RootPart.Scale.Y); 3539 float y = (scale.Y / RootPart.Scale.Y);
3510 float z = (scale.Z / RootPart.Scale.Z); 3540 float z = (scale.Z / RootPart.Scale.Z);
3511 3541
3512 SceneObjectPart[] parts; 3542 SceneObjectPart[] parts = m_parts.GetArray();
3513 if (x > 1.0f || y > 1.0f || z > 1.0f) 3543
3544 if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f))
3514 { 3545 {
3515 parts = m_parts.GetArray();
3516 for (int i = 0; i < parts.Length; i++) 3546 for (int i = 0; i < parts.Length; i++)
3517 { 3547 {
3518 SceneObjectPart obPart = parts[i]; 3548 SceneObjectPart obPart = parts[i];
@@ -3525,7 +3555,7 @@ namespace OpenSim.Region.Framework.Scenes
3525 3555
3526 if (pa != null && pa.IsPhysical) 3556 if (pa != null && pa.IsPhysical)
3527 { 3557 {
3528 if (oldSize.X * x > m_scene.m_maxPhys) 3558 if (oldSize.X * x > Scene.m_maxPhys)
3529 { 3559 {
3530 f = m_scene.m_maxPhys / oldSize.X; 3560 f = m_scene.m_maxPhys / oldSize.X;
3531 a = f / x; 3561 a = f / x;
@@ -3533,8 +3563,16 @@ namespace OpenSim.Region.Framework.Scenes
3533 y *= a; 3563 y *= a;
3534 z *= a; 3564 z *= a;
3535 } 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 }
3536 3574
3537 if (oldSize.Y * y > m_scene.m_maxPhys) 3575 if (oldSize.Y * y > Scene.m_maxPhys)
3538 { 3576 {
3539 f = m_scene.m_maxPhys / oldSize.Y; 3577 f = m_scene.m_maxPhys / oldSize.Y;
3540 a = f / y; 3578 a = f / y;
@@ -3542,8 +3580,16 @@ namespace OpenSim.Region.Framework.Scenes
3542 y *= a; 3580 y *= a;
3543 z *= a; 3581 z *= a;
3544 } 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 }
3545 3591
3546 if (oldSize.Z * z > m_scene.m_maxPhys) 3592 if (oldSize.Z * z > Scene.m_maxPhys)
3547 { 3593 {
3548 f = m_scene.m_maxPhys / oldSize.Z; 3594 f = m_scene.m_maxPhys / oldSize.Z;
3549 a = f / z; 3595 a = f / z;
@@ -3551,10 +3597,18 @@ namespace OpenSim.Region.Framework.Scenes
3551 y *= a; 3597 y *= a;
3552 z *= a; 3598 z *= a;
3553 } 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 }
3554 } 3608 }
3555 else 3609 else
3556 { 3610 {
3557 if (oldSize.X * x > m_scene.m_maxNonphys) 3611 if (oldSize.X * x > Scene.m_maxNonphys)
3558 { 3612 {
3559 f = m_scene.m_maxNonphys / oldSize.X; 3613 f = m_scene.m_maxNonphys / oldSize.X;
3560 a = f / x; 3614 a = f / x;
@@ -3562,8 +3616,16 @@ namespace OpenSim.Region.Framework.Scenes
3562 y *= a; 3616 y *= a;
3563 z *= a; 3617 z *= a;
3564 } 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 }
3565 3627
3566 if (oldSize.Y * y > m_scene.m_maxNonphys) 3628 if (oldSize.Y * y > Scene.m_maxNonphys)
3567 { 3629 {
3568 f = m_scene.m_maxNonphys / oldSize.Y; 3630 f = m_scene.m_maxNonphys / oldSize.Y;
3569 a = f / y; 3631 a = f / y;
@@ -3571,8 +3633,16 @@ namespace OpenSim.Region.Framework.Scenes
3571 y *= a; 3633 y *= a;
3572 z *= a; 3634 z *= a;
3573 } 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 }
3574 3644
3575 if (oldSize.Z * z > m_scene.m_maxNonphys) 3645 if (oldSize.Z * z > Scene.m_maxNonphys)
3576 { 3646 {
3577 f = m_scene.m_maxNonphys / oldSize.Z; 3647 f = m_scene.m_maxNonphys / oldSize.Z;
3578 a = f / z; 3648 a = f / z;
@@ -3580,6 +3650,14 @@ namespace OpenSim.Region.Framework.Scenes
3580 y *= a; 3650 y *= a;
3581 z *= a; 3651 z *= a;
3582 } 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 }
3583 } 3661 }
3584 } 3662 }
3585 } 3663 }
@@ -3592,7 +3670,6 @@ namespace OpenSim.Region.Framework.Scenes
3592 3670
3593 RootPart.Resize(prevScale); 3671 RootPart.Resize(prevScale);
3594 3672
3595 parts = m_parts.GetArray();
3596 for (int i = 0; i < parts.Length; i++) 3673 for (int i = 0; i < parts.Length; i++)
3597 { 3674 {
3598 SceneObjectPart obPart = parts[i]; 3675 SceneObjectPart obPart = parts[i];