aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-29 02:10:34 -0700
committerTom Grimshaw2010-05-29 02:10:34 -0700
commite3dac1292ef000daadda3e264354d8df0fc77c22 (patch)
tree932b9872e470b7ac7f20ed185dbba4b7caa17fa4 /OpenSim
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC-e3dac1292ef000daadda3e264354d8df0fc77c22.zip
opensim-SC-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.gz
opensim-SC-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.bz2
opensim-SC-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.xz
Implement suspended updates - When an operation is occurring on lots of prims in a single group, don't schedule any updates until the operation has completed. This makes things like llSetAlpha(LINK_SET,0.0,ALL_SIDES); a *lot* faster, more efficient and less buggy, and also makes unlinking a lot better. Linking is still treacherous.. this needs to be analysed.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/ModuleLoader.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs132
5 files changed, 168 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs
index 23be9c2..69ba2042 100644
--- a/OpenSim/Region/Framework/ModuleLoader.cs
+++ b/OpenSim/Region/Framework/ModuleLoader.cs
@@ -226,7 +226,8 @@ namespace OpenSim.Region.Framework
226 "[MODULES]: Could not load types for [{0}]. Exception {1}", pluginAssembly.FullName, e); 226 "[MODULES]: Could not load types for [{0}]. Exception {1}", pluginAssembly.FullName, e);
227 227
228 // justincc: Right now this is fatal to really get the user's attention 228 // justincc: Right now this is fatal to really get the user's attention
229 throw e; 229 // TomMeta: WTF? No, how about we /don't/ throw a fatal exception when there's no need to?
230 //throw e;
230 } 231 }
231 } 232 }
232 233
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index d4658ec..445c2c8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1499,10 +1499,13 @@ namespace OpenSim.Region.Framework.Scenes
1499 /// <param name="childPrims"></param> 1499 /// <param name="childPrims"></param>
1500 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) 1500 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1501 { 1501 {
1502 SceneObjectGroup parentGroup = root.ParentGroup;
1503 if (parentGroup == null) return;
1502 Monitor.Enter(m_updateLock); 1504 Monitor.Enter(m_updateLock);
1505
1503 try 1506 try
1504 { 1507 {
1505 SceneObjectGroup parentGroup = root.ParentGroup; 1508 parentGroup.areUpdatesSuspended = true;
1506 1509
1507 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1510 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1508 if (parentGroup != null) 1511 if (parentGroup != null)
@@ -1541,12 +1544,12 @@ namespace OpenSim.Region.Framework.Scenes
1541 // occur on link to invoke this elsewhere (such as object selection) 1544 // occur on link to invoke this elsewhere (such as object selection)
1542 parentGroup.RootPart.AddFlag(PrimFlags.CreateSelected); 1545 parentGroup.RootPart.AddFlag(PrimFlags.CreateSelected);
1543 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1546 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1544 parentGroup.HasGroupChanged = true;
1545 parentGroup.ScheduleGroupForFullUpdate();
1546
1547 } 1547 }
1548 finally 1548 finally
1549 { 1549 {
1550 parentGroup.areUpdatesSuspended = false;
1551 parentGroup.HasGroupChanged = true;
1552 parentGroup.ScheduleGroupForFullUpdate();
1550 Monitor.Exit(m_updateLock); 1553 Monitor.Exit(m_updateLock);
1551 } 1554 }
1552 } 1555 }
@@ -1583,11 +1586,22 @@ namespace OpenSim.Region.Framework.Scenes
1583 } 1586 }
1584 } 1587 }
1585 1588
1586 foreach (SceneObjectPart child in childParts) 1589 if (childParts.Count > 0)
1587 { 1590 {
1588 // Unlink all child parts from their groups 1591 try
1589 // 1592 {
1590 child.ParentGroup.DelinkFromGroup(child, true); 1593 childParts[0].ParentGroup.areUpdatesSuspended = true;
1594 foreach (SceneObjectPart child in childParts)
1595 {
1596 // Unlink all child parts from their groups
1597 //
1598 child.ParentGroup.DelinkFromGroup(child, true);
1599 }
1600 }
1601 finally
1602 {
1603 childParts[0].ParentGroup.areUpdatesSuspended = false;
1604 }
1591 } 1605 }
1592 1606
1593 foreach (SceneObjectPart root in rootParts) 1607 foreach (SceneObjectPart root in rootParts)
@@ -1611,10 +1625,21 @@ namespace OpenSim.Region.Framework.Scenes
1611 if (numChildren > 1) 1625 if (numChildren > 1)
1612 sendEventsToRemainder = false; 1626 sendEventsToRemainder = false;
1613 1627
1614 foreach (SceneObjectPart p in newSet) 1628 if (newSet.Count > 0)
1615 { 1629 {
1616 if (p != group.RootPart) 1630 try
1617 group.DelinkFromGroup(p, sendEventsToRemainder); 1631 {
1632 newSet[0].ParentGroup.areUpdatesSuspended = true;
1633 foreach (SceneObjectPart p in newSet)
1634 {
1635 if (p != group.RootPart)
1636 group.DelinkFromGroup(p, sendEventsToRemainder);
1637 }
1638 }
1639 finally
1640 {
1641 newSet[0].ParentGroup.areUpdatesSuspended = false;
1642 }
1618 } 1643 }
1619 1644
1620 // If there is more than one prim remaining, we 1645 // If there is more than one prim remaining, we
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index cee2be3..9ebb168 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -109,9 +109,26 @@ namespace OpenSim.Region.Framework.Scenes
109 private long m_maxPersistTime = 0; 109 private long m_maxPersistTime = 0;
110 private long m_minPersistTime = 0; 110 private long m_minPersistTime = 0;
111 private Random m_rand; 111 private Random m_rand;
112 private bool m_suspendUpdates;
112 113
113 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim(); 114 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
114 115
116 public bool areUpdatesSuspended
117 {
118 get
119 {
120 return m_suspendUpdates;
121 }
122 set
123 {
124 m_suspendUpdates = value;
125 if (!value)
126 {
127 QueueForUpdateCheck();
128 }
129 }
130 }
131
115 public void lockPartsForRead(bool locked) 132 public void lockPartsForRead(bool locked)
116 { 133 {
117 if (locked) 134 if (locked)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c84596b..6e73b65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2724,7 +2724,10 @@ namespace OpenSim.Region.Framework.Scenes
2724 2724
2725 if (m_parentGroup != null) 2725 if (m_parentGroup != null)
2726 { 2726 {
2727 m_parentGroup.QueueForUpdateCheck(); 2727 if (!m_parentGroup.areUpdatesSuspended)
2728 {
2729 m_parentGroup.QueueForUpdateCheck();
2730 }
2728 } 2731 }
2729 2732
2730 int timeNow = Util.UnixTimeSinceEpoch(); 2733 int timeNow = Util.UnixTimeSinceEpoch();
@@ -4450,8 +4453,9 @@ namespace OpenSim.Region.Framework.Scenes
4450 { 4453 {
4451 m_shape.TextureEntry = textureEntry; 4454 m_shape.TextureEntry = textureEntry;
4452 TriggerScriptChangedEvent(Changed.TEXTURE); 4455 TriggerScriptChangedEvent(Changed.TEXTURE);
4453 4456 m_updateFlag = 1;
4454 ParentGroup.HasGroupChanged = true; 4457 ParentGroup.HasGroupChanged = true;
4458
4455 //This is madness.. 4459 //This is madness..
4456 //ParentGroup.ScheduleGroupForFullUpdate(); 4460 //ParentGroup.ScheduleGroupForFullUpdate();
4457 //This is sparta 4461 //This is sparta
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 68f6e7b..bb02fa3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1649,9 +1649,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1649 m_host.AddScriptLPS(1); 1649 m_host.AddScriptLPS(1);
1650 1650
1651 List<SceneObjectPart> parts = GetLinkParts(linknumber); 1651 List<SceneObjectPart> parts = GetLinkParts(linknumber);
1652 1652 if (parts.Count > 0)
1653 foreach (SceneObjectPart part in parts) 1653 {
1654 SetAlpha(part, alpha, face); 1654 try
1655 {
1656 parts[0].ParentGroup.areUpdatesSuspended = true;
1657 foreach (SceneObjectPart part in parts)
1658 SetAlpha(part, alpha, face);
1659 }
1660 finally
1661 {
1662 parts[0].ParentGroup.areUpdatesSuspended = false;
1663 }
1664 }
1655 } 1665 }
1656 1666
1657 protected void SetAlpha(SceneObjectPart part, double alpha, int face) 1667 protected void SetAlpha(SceneObjectPart part, double alpha, int face)
@@ -1816,10 +1826,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1816 m_host.AddScriptLPS(1); 1826 m_host.AddScriptLPS(1);
1817 1827
1818 List<SceneObjectPart> parts = GetLinkParts(linknumber); 1828 List<SceneObjectPart> parts = GetLinkParts(linknumber);
1819 1829 if (parts.Count > 0)
1820 foreach (SceneObjectPart part in parts) 1830 {
1821 SetTexture(part, texture, face); 1831 try
1822 1832 {
1833 parts[0].ParentGroup.areUpdatesSuspended = true;
1834 foreach (SceneObjectPart part in parts)
1835 SetTexture(part, texture, face);
1836 }
1837 finally
1838 {
1839 parts[0].ParentGroup.areUpdatesSuspended = false;
1840 }
1841 }
1823 ScriptSleep(200); 1842 ScriptSleep(200);
1824 } 1843 }
1825 1844
@@ -3661,9 +3680,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3661 public void llSetLinkColor(int linknumber, LSL_Vector color, int face) 3680 public void llSetLinkColor(int linknumber, LSL_Vector color, int face)
3662 { 3681 {
3663 List<SceneObjectPart> parts = GetLinkParts(linknumber); 3682 List<SceneObjectPart> parts = GetLinkParts(linknumber);
3664 3683 if (parts.Count > 0)
3665 foreach (SceneObjectPart part in parts) 3684 {
3666 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 3685 try
3686 {
3687 parts[0].ParentGroup.areUpdatesSuspended = true;
3688 foreach (SceneObjectPart part in parts)
3689 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
3690 }
3691 finally
3692 {
3693 parts[0].ParentGroup.areUpdatesSuspended = false;
3694 }
3695 }
3667 } 3696 }
3668 3697
3669 public void llCreateLink(string target, int parent) 3698 public void llCreateLink(string target, int parent)
@@ -3776,10 +3805,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3776 // Restructuring Multiple Prims. 3805 // Restructuring Multiple Prims.
3777 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3806 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3778 parts.Remove(parentPrim.RootPart); 3807 parts.Remove(parentPrim.RootPart);
3779 foreach (SceneObjectPart part in parts) 3808 if (parts.Count > 0)
3780 { 3809 {
3781 parentPrim.DelinkFromGroup(part.LocalId, true); 3810 try
3811 {
3812 parts[0].ParentGroup.areUpdatesSuspended = true;
3813 foreach (SceneObjectPart part in parts)
3814 {
3815 parentPrim.DelinkFromGroup(part.LocalId, true);
3816 }
3817 }
3818 finally
3819 {
3820 parts[0].ParentGroup.areUpdatesSuspended = false;
3821 }
3782 } 3822 }
3823
3783 parentPrim.HasGroupChanged = true; 3824 parentPrim.HasGroupChanged = true;
3784 parentPrim.ScheduleGroupForFullUpdate(); 3825 parentPrim.ScheduleGroupForFullUpdate();
3785 parentPrim.TriggerScriptChangedEvent(Changed.LINK); 3826 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
@@ -3788,11 +3829,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3788 { 3829 {
3789 SceneObjectPart newRoot = parts[0]; 3830 SceneObjectPart newRoot = parts[0];
3790 parts.Remove(newRoot); 3831 parts.Remove(newRoot);
3791 foreach (SceneObjectPart part in parts) 3832
3833 try
3792 { 3834 {
3793 part.UpdateFlag = 0; 3835 parts[0].ParentGroup.areUpdatesSuspended = true;
3794 newRoot.ParentGroup.LinkToGroup(part.ParentGroup); 3836 foreach (SceneObjectPart part in parts)
3837 {
3838 part.UpdateFlag = 0;
3839 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
3840 }
3795 } 3841 }
3842 finally
3843 {
3844 parts[0].ParentGroup.areUpdatesSuspended = false;
3845 }
3846
3847
3796 newRoot.ParentGroup.HasGroupChanged = true; 3848 newRoot.ParentGroup.HasGroupChanged = true;
3797 newRoot.ParentGroup.ScheduleGroupForFullUpdate(); 3849 newRoot.ParentGroup.ScheduleGroupForFullUpdate();
3798 } 3850 }
@@ -3818,11 +3870,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3818 3870
3819 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3871 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3820 parts.Remove(parentPrim.RootPart); 3872 parts.Remove(parentPrim.RootPart);
3821 3873 if (parts.Count > 0)
3822 foreach (SceneObjectPart part in parts)
3823 { 3874 {
3824 parentPrim.DelinkFromGroup(part.LocalId, true); 3875 try
3825 parentPrim.TriggerScriptChangedEvent(Changed.LINK); 3876 {
3877 parts[0].ParentGroup.areUpdatesSuspended = true;
3878 foreach (SceneObjectPart part in parts)
3879 {
3880 parentPrim.DelinkFromGroup(part.LocalId, true);
3881 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3882 }
3883 }
3884 finally
3885 {
3886 parts[0].ParentGroup.areUpdatesSuspended = false;
3887 }
3826 } 3888 }
3827 parentPrim.HasGroupChanged = true; 3889 parentPrim.HasGroupChanged = true;
3828 parentPrim.ScheduleGroupForFullUpdate(); 3890 parentPrim.ScheduleGroupForFullUpdate();
@@ -5664,10 +5726,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5664 m_host.AddScriptLPS(1); 5726 m_host.AddScriptLPS(1);
5665 5727
5666 List<SceneObjectPart> parts = GetLinkParts(linknumber); 5728 List<SceneObjectPart> parts = GetLinkParts(linknumber);
5667 5729 if (parts.Count > 0)
5668 foreach (var part in parts)
5669 { 5730 {
5670 SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); 5731 try
5732 {
5733 parts[0].ParentGroup.areUpdatesSuspended = true;
5734 foreach (var part in parts)
5735 {
5736 SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
5737 }
5738 }
5739 finally
5740 {
5741 parts[0].ParentGroup.areUpdatesSuspended = false;
5742 }
5671 } 5743 }
5672 } 5744 }
5673 5745
@@ -7068,9 +7140,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7068 m_host.AddScriptLPS(1); 7140 m_host.AddScriptLPS(1);
7069 7141
7070 List<SceneObjectPart> parts = GetLinkParts(linknumber); 7142 List<SceneObjectPart> parts = GetLinkParts(linknumber);
7071 7143 if (parts.Count>0)
7072 foreach (SceneObjectPart part in parts) 7144 {
7073 SetPrimParams(part, rules); 7145 try
7146 {
7147 parts[0].ParentGroup.areUpdatesSuspended = true;
7148 foreach (SceneObjectPart part in parts)
7149 SetPrimParams(part, rules);
7150 }
7151 finally
7152 {
7153 parts[0].ParentGroup.areUpdatesSuspended = false;
7154 }
7155 }
7074 } 7156 }
7075 7157
7076 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 7158 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)